Armin_x3 war wohl schneller
Dann so ..
forward Start(playerid);
#define yellow 0xFFFF00AA
new carstarted[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{ if(newstate==PLAYER_STATE_DRIVER)
TogglePlayerControllable(playerid,false);
SendClientMessage(playerid,yellow,"zum starten taste 2 drücken");
carstarted[playerid] = 0;
return 1;
}
public Start(playerid)
{
new RandomlyStart = random(2);
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
switch(RandomlyStart)
{
case 0:
{
TogglePlayerControllable(playerid,true);
SendClientMessage(playerid,yellow,"Auto ist gestartet");
carstarted[playerid] = 1;
}
case 1:
{
SendClientMessage(playerid,yellow,"Fahrzeug erfolgreich gestartet");
}
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & (KEY_SUBMISSION)) == (KEY_SUBMISSION))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(carstarted[playerid] == 0)
SendClientMessage(playerid,yellow,"Fahrzeug konnte nicht gestartet werden");
SetTimerEx("Start",2790,0,"i",playerid);
}
}
else
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, true);
}
}
}
return 1;
}