25.11.2011, 17:29
pawn Код:
new smoke[MAX_VEHICLES];
new LastVehicle[MAX_PLAYERS];
new bool:smoking[MAX_VEHICLES] = false; // todas devem ser variaveis globais
if (!strcmp(cmdtext, "/fumaca", true))
{
new vehid = GetPlayerVehicleID(playerid);
new carid = GetVehicleModel(vehid);
if(carid == 511 || carid == 512 || carid == 593 || carid == 520 || carid == 553 || carid == 476 || carid == 519 || carid == 460)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(!smoking[vehid])
{
smoke[vehid] = CreateObject(2780,0,0,0,0,0,50000);
AttachObjectToVehicle(smoke[vehid], vehid, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
smoking[vehid] = true;
return SendClientMessage(playerid, COLOR_WHITE, "Fumaca ligada.");
}
else
{
DestroyObject(smoke[vehid]);
smoking[vehid] = false;
return SendClientMessage(playerid, COLOR_WHITE, "Fumaca desligada.");
}
}
else return SendClientMessage(playerid, -1, "Vocк nгo estб dirigindo a aeronave!");
}
else return SendClientMessage(playerid, -1, "Vocк nгo estб em uma aeronave!");
}
//public onplayerstatechange
if(newstate == PLAYER_STATE_DRIVER)
LastVehicle[playerid] = GetPlayerVehicleID(playerid);
if(oldstate == PLAYER_STATE_DRIVER)
{
if(smoking[LastVehicle[playerid]])
DestroyObject(LastVehicle[playerid]);
LastVehicle[playerid] = 0;
}