Hier der /motor command
if(strcmp("/motor", cmdtext, true) == 0)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(vEngine[vehicleid] == 0)
{
vEngine[vehicleid] = 1;
SendClientMessage(playerid,COLOR,"Du hast den Motor angeschaltet ");
BrowsingCar = 0;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new string[128];
format(string,sizeof(string),"%s hat den Motor angeschaltet",playername);
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetDistanceBetweenPlayers(playerid,i) <= 10)
{
SendClientMessage(i,COLOR,string);
}
}
}
}
else
{
vEngine[vehicleid] = 0;
SendClientMessage(playerid,COLOR,"Du hast den Motor ausgeschaltet ");
BrowsingCar = 1;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new string2[128];
format(string2,sizeof(string2),"%s hat den Motor ausgeschaltet",playername);
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetDistanceBetweenPlayers(playerid,i) <= 10)
{
SendClientMessage(i,COLOR,string2);
}
}
}
}
}
Dann machst du noch unter public OnPlayerExitVehicle
public OnPlayerExitVehicle(playerid, vehicleid)
{
vEngine[vehicleid] = 0;
SendClientMessage(playerid,COLOR,"Der Motor ist automatisch aus gegangen");
}
sowie
public OnPlayerenterVehicle(playerid, vehicleid)
{
SendClientMessage(playerid,COLOR,"Benutze /motor um das Auto zu starten bzw. zu stoppen");
}