Wie kann ich den Speed vom Fahrzeug und den Zustand abfragen?
Beiträge von Marschl
-
-
Ich möchte, dass wenn der Spieler in irgendeiner Art und weiße das Auto Verlässt, die Textdraws gelöscht werden.
Wo liegt hier der Fehler?
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_NONE)
{
PlayerTextDrawDestroy(playerid, Tacho1[playerid]);
PlayerTextDrawDestroy(playerid, Tacho2[playerid]);
PlayerTextDrawDestroy(playerid, Tacho3[playerid]);
PlayerTextDrawDestroy(playerid, Tacho4[playerid]);
PlayerTextDrawDestroy(playerid, Tacho5[playerid]);
PlayerTextDrawDestroy(playerid, Tacho6[playerid]);
PlayerTextDrawDestroy(playerid, Tacho7[playerid]);
PlayerTextDrawDestroy(playerid, Tacho8[playerid]);
PlayerTextDrawDestroy(playerid, Tacho9[playerid]);
PlayerTextDrawDestroy(playerid, Tacho10[playerid]);
PlayerTextDrawDestroy(playerid, Tacho11[playerid]);
PlayerTextDrawDestroy(playerid, Tacho12[playerid]);
} -
wie kann ich das beheben?
-
Wie gesagt dann geht es ja
-
Also bei mir nicht, kann es eventuell daran liegen wie ich den Car Name Abfrage?
Weil ohne das geht es nämlich
-
public OnPlayerConnect(playerid)
{
//Tacho
Tacho1[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 360.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho1[playerid], 255);
PlayerTextDrawFont(playerid, Tacho1[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho1[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho1[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho1[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho1[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho1[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho1[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho1[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho1[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho1[playerid], 0);Tacho2[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 374.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho2[playerid], 255);
PlayerTextDrawFont(playerid, Tacho2[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho2[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho2[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho2[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho2[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho2[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho2[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho2[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho2[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho2[playerid], 0);Tacho3[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 388.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho3[playerid], 255);
PlayerTextDrawFont(playerid, Tacho3[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho3[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho3[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho3[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho3[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho3[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho3[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho3[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho3[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho3[playerid], 0);Tacho4[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 402.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho4[playerid], 255);
PlayerTextDrawFont(playerid, Tacho4[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho4[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho4[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho4[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho4[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho4[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho4[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho4[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho4[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho4[playerid], 0);Tacho5[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 416.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho5[playerid], 255);
PlayerTextDrawFont(playerid, Tacho5[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho5[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho5[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho5[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho5[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho5[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho5[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho5[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho5[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho5[playerid], 0);Tacho6[playerid] = CreatePlayerTextDraw(playerid, 509.000000, 430.000000, "_");
PlayerTextDrawBackgroundColor(playerid, Tacho6[playerid], 255);
PlayerTextDrawFont(playerid, Tacho6[playerid], 1);
PlayerTextDrawLetterSize(playerid, Tacho6[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, Tacho6[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho6[playerid], 0);
PlayerTextDrawSetProportional(playerid, Tacho6[playerid], 1);
PlayerTextDrawSetShadow(playerid, Tacho6[playerid], 1);
PlayerTextDrawUseBox(playerid, Tacho6[playerid], 1);
PlayerTextDrawBoxColor(playerid, Tacho6[playerid], 119);
PlayerTextDrawTextSize(playerid, Tacho6[playerid], 621.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Tacho6[playerid], 0);Tacho7[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 359.000000, " "); //Besitzer
PlayerTextDrawBackgroundColor(playerid, Tacho7[playerid], 255);
PlayerTextDrawFont(playerid, Tacho7[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho7[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho7[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho7[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho7[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho7[playerid], 0);Tacho8[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 373.000000, " "); //Autoname
PlayerTextDrawBackgroundColor(playerid, Tacho8[playerid], 255);
PlayerTextDrawFont(playerid, Tacho8[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho8[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho8[playerid], -16776961);
PlayerTextDrawSetOutline(playerid, Tacho8[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho8[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho8[playerid], 0);Tacho9[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 387.000000, " "); //Schnelligkeit
PlayerTextDrawBackgroundColor(playerid, Tacho9[playerid], 255);
PlayerTextDrawFont(playerid, Tacho9[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho9[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho9[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho9[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho9[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho9[playerid], 0);Tacho10[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 401.000000, " "); //Zustand
PlayerTextDrawBackgroundColor(playerid, Tacho10[playerid], 255);
PlayerTextDrawFont(playerid, Tacho10[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho10[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho10[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho10[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho10[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho10[playerid], 0);Tacho11[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 415.000000, " "); //Tank
PlayerTextDrawBackgroundColor(playerid, Tacho11[playerid], 255);
PlayerTextDrawFont(playerid, Tacho11[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho11[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho11[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho11[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho11[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho11[playerid], 0);Tacho12[playerid] = CreatePlayerTextDraw(playerid, 512.000000, 429.000000, " "); //Kilometerstand
PlayerTextDrawBackgroundColor(playerid, Tacho12[playerid], 255);
PlayerTextDrawFont(playerid, Tacho12[playerid], 2);
PlayerTextDrawLetterSize(playerid, Tacho12[playerid], 0.270000, 1.100000);
PlayerTextDrawColor(playerid, Tacho12[playerid], -1);
PlayerTextDrawSetOutline(playerid, Tacho12[playerid], 1);
PlayerTextDrawSetProportional(playerid, Tacho12[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Tacho12[playerid], 0);
return 1;
} -
Funktioniert immer noch nicht
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_GELB, "Info: "HTML_WEIS"Du kannst das Fahrzeug "HTML_GELB"mit der Taste 2 oder mit /motor "HTML_WEIS"starten!");new tcn[24];
new mID = GetVehicleModel(GetPlayerVehicleID(playerid));
format(tcn, sizeof(tcn), "%s", VehicleNames[mID]);
PlayerTextDrawSetString(playerid, Tacho8[playerid], tcn);PlayerTextDrawShow(playerid, Tacho1[playerid]);
PlayerTextDrawShow(playerid, Tacho2[playerid]);
PlayerTextDrawShow(playerid, Tacho3[playerid]);
PlayerTextDrawShow(playerid, Tacho4[playerid]);
PlayerTextDrawShow(playerid, Tacho5[playerid]);
PlayerTextDrawShow(playerid, Tacho6[playerid]);
PlayerTextDrawShow(playerid, Tacho7[playerid]);
PlayerTextDrawShow(playerid, Tacho8[playerid]);
PlayerTextDrawShow(playerid, Tacho9[playerid]);
PlayerTextDrawShow(playerid, Tacho10[playerid]);
PlayerTextDrawShow(playerid, Tacho11[playerid]);
PlayerTextDrawShow(playerid, Tacho12[playerid]);
}
return 1;
} -
Funktioniert immernoch nicht
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_GELB, "Info: "HTML_WEIS"Du kannst das Fahrzeug "HTML_GELB"mit der Taste 2 oder mit /motor "HTML_WEIS"starten!");new tachocarname[24];
new vehicleid = GetPlayerVehicleID(playerid);
format(tachocarname, sizeof(tachocarname), "%s", vehName[vehicleid]);
PlayerTextDrawSetString(playerid, Tacho8[playerid], tachocarname);PlayerTextDrawShow(playerid, Tacho1[playerid]);
PlayerTextDrawShow(playerid, Tacho2[playerid]);
PlayerTextDrawShow(playerid, Tacho3[playerid]);
PlayerTextDrawShow(playerid, Tacho4[playerid]);
PlayerTextDrawShow(playerid, Tacho5[playerid]);
PlayerTextDrawShow(playerid, Tacho6[playerid]);
PlayerTextDrawShow(playerid, Tacho7[playerid]);
PlayerTextDrawShow(playerid, Tacho8[playerid]);
PlayerTextDrawShow(playerid, Tacho9[playerid]);
PlayerTextDrawShow(playerid, Tacho10[playerid]);
PlayerTextDrawShow(playerid, Tacho11[playerid]);
PlayerTextDrawShow(playerid, Tacho12[playerid]);
}
return 1;
} -
Ja werden sie
-
Oki danke
Noch eine Frage warum werden die Textdraws nicht beim einsteigen erstellt?
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, COLOR_GELB, "Info: "HTML_WEIS"Du kannst das Fahrzeug "HTML_GELB"mit der Taste 2 oder mit /motor "HTML_WEIS"starten!");
PlayerTextDrawShow(playerid, Tacho1[playerid]);
PlayerTextDrawShow(playerid, Tacho2[playerid]);
PlayerTextDrawShow(playerid, Tacho3[playerid]);
PlayerTextDrawShow(playerid, Tacho4[playerid]);
PlayerTextDrawShow(playerid, Tacho5[playerid]);
PlayerTextDrawShow(playerid, Tacho6[playerid]);
PlayerTextDrawShow(playerid, Tacho7[playerid]);
PlayerTextDrawShow(playerid, Tacho8[playerid]);
PlayerTextDrawShow(playerid, Tacho9[playerid]);
PlayerTextDrawShow(playerid, Tacho10[playerid]);
PlayerTextDrawShow(playerid, Tacho11[playerid]);
PlayerTextDrawShow(playerid, Tacho12[playerid]);
}
return 1;
} -
Bei Sekunde wird nur ein % angezeigt
-
Danke @Canna
wie kann ich bei der Uhrzeit noch Sekunden ranhängen?
forward UpdateUhrzeit(playerid);
public UpdateUhrzeit(playerid)
{
new Hour,Minute,Sec,String[256];
gettime(Hour,Minute,Sec);
if(Hour<9 && Minute<9){format(String,sizeof(String),"0%d:0%d",Hour,Minute);}
else if(Hour>9 && Minute<9){format(String,sizeof(String),"%d:0%d",Hour,Minute);}
else if(Hour<9 && Minute>9){format(String,sizeof(String),"0%d:%d",Hour,Minute);}
else{format(String,sizeof(String),"%d:%d",Hour,Minute);}
PlayerTextDrawSetString(playerid, TimeDraw[playerid],String);
SetWorldTime(Hour);
return 1;
} -
Hallo,
wie kann ich in mein Textdraw dass aktuelle Datum eintragen?Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 559.000000, 6.000000, " ");
PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 2);
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.270000, 1.200000);
PlayerTextDrawColor(playerid, Textdraw0[playerid], -16776961);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Textdraw0[playerid], 0); -
ohh bin bisschen übermüdet danke bin garnicht draufgekommen
//edit
Hab noch eine Frage, wie kann ich auf das Supcar eine Rote Sirene machen?
-
Hallöchen, wenn ich auf Supcar löschen gehe, spawnt ein Maverick. Ich finde mein Fehler irgendwie nicht
ocmd:supcar(playerid, params[])
{
if(sI[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_ROT, ">> Du bist kein Admin");
{
ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
}
return 1;
}if(dialogid == D_ADM_SUPCAR)
{
if(response)
{
new Float:a_x, Float:a_y, Float:a_z, Float:a_r;
GetPlayerFacingAngle(playerid, a_r);
GetPlayerPos(playerid, a_x, a_y, a_z);
switch(listitem)
{
case 0:
{
if(sI[playerid][pSupCar] == true)return ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
supCar[playerid] = CreateVehicle(560, a_x, a_y, a_z, a_r, 132, 132, -1, 1);
SetVehicleNumberPlate(supCar[playerid], "SupCar");
PutPlayerInVehicle(playerid, supCar[playerid], 0);
sI[playerid][pSupCar] = true;
}
case 1:
{
if(sI[playerid][pSupCar] == true)return SendClientMessage(playerid, COLOR_ROT, ">> Du hast bereits ein Supcar gespawnt!"), ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
supCar[playerid] = CreateVehicle(411, a_x, a_y, a_z, a_r, 132, 132, -1, 1);
SetVehicleNumberPlate(supCar[playerid], "SupCar");
PutPlayerInVehicle(playerid, supCar[playerid], 0);
sI[playerid][pSupCar] = true;
}
case 2:
{
if(sI[playerid][pSupCar] == true)return SendClientMessage(playerid, COLOR_ROT, ">> Du hast bereits ein Supcar gespawnt!"), ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
supCar[playerid] = CreateVehicle(522, a_x, a_y, a_z, a_r, 132, 132, -1, 1);
SetVehicleNumberPlate(supCar[playerid], "SupCar");
PutPlayerInVehicle(playerid, supCar[playerid], 0);
sI[playerid][pSupCar] = true;
}
case 4:
{
if(sI[playerid][pSupCar] == true)return SendClientMessage(playerid, COLOR_ROT, ">> Du hast bereits ein Supcar gespawnt!"), ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
supCar[playerid] = CreateVehicle(487, a_x, a_y, a_z, a_r, 132, 132, -1, 1);
SetVehicleNumberPlate(supCar[playerid], "SupCar");
PutPlayerInVehicle(playerid, supCar[playerid], 0);
sI[playerid][pSupCar] = true;
}
case 5:
{
if(sI[playerid][pSupCar] == false)return SendClientMessage(playerid, COLOR_ROT, ">> Du hast kein SupCar gespawnt!"), ShowPlayerDialog(playerid, D_ADM_SUPCAR, DIALOG_STYLE_LIST, ""SERVER_HTML""SERVER_TAG""HTML_WEIS": Supcar", "Sultan \nInfernus \nNRG \nMaverick \n"HTML_ROT"SupCar löschen", "Spawnen", "Zurück");
DestroyVehicle(supCar[playerid]);
sI[playerid][pSupCar] = false;
}
}
}
else
{
return 0;
}
return 1;
} -
Ich möchte es aber gern per stock machen. also dass ich die Funktion GiveMoney(playerid, money) habe.
Also dass ich wenn der Spieler Geld bekommen soll einfach GiveMoney(playerid, 2000); machen kann und bei Minus einfach GiveMoney(playerid, -2000); -
sI [playerid][pBarGeld] -= money;
@Marcel_Colbetti bzw einfach +Ist es auch so möglich Geld zu addieren?
-
Ich habe mir jetzt einen Stock erstellt um von der Variable pBarGeld etwas abzuziehen, leider weiß ich nicht wie ich es machen muss, dass ich von der Variable nur den angegebenen Betrag addiere oder subtrahiere.
stock GiveMoney(playerid, money)
{
new aktuellgeld;
aktuellgeld = sI[playerid][pBarGeld];
sI[playerid][pBarGeld] = aktuellgeld +- money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, sI[playerid][pBarGeld]);
return 1;
} -
-
Wenn ich Abfragen will ob die Taste "N" gedrückt ist wie stell ich dass an? So geht es InGame nicht
if(newkeys & KEY_NO)
{
if(IsPlayerInRangeOfPoint(playerid, 1211.2795,-1749.7644,13.5941, 2.0)) //Stadthalle
{
SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
}
}wo liegt mein Fehler danke im voraus