new Carro[20];
if(dialogid == 666)
{
if(response == 0)
{
SendClientMessage(playerid, COR_RED, "Voce Optou por nao ir no Evento!");
TrazerKart[playerid] = 0;
return 1;
}
if(response == 1)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COR_RED,"ERRO* voce esta preso e nao pode ir no Evento!");
TrazerKart[playerid] = 0;
return 0;
}
new tmp[128];
new plo, world;
plo = ReturnUser(tmp);
world = GetPlayerVirtualWorld(playerid);
new tmpcar = GetPlayerVehicleID(playerid);
SetPlayerVirtualWorld(plo,world);
RemovePlayerFromVehicle(tmpcar);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SetPlayerVirtualWorld(plo,world);
ResetPlayerWeaponsEx(playerid);
PlayerInfo[playerid][pTrazerKart] = 1;
SendClientMessage(playerid,COR_RED,"Bem vindo ao evento!");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pTrazerKart] == 1)
{
if(!IsPlayerInVehicle(i, Carro[random(20)]))
{
SetPlayerInterior(i,0);
PutPlayerInVehicle(i, Carro[random(20)], 0);
Jogadoreskart++;
EVENTO[i] = 1;
SetPlayerRaceCheckpoint(i,1,-1341.8914,-671.3342,1055.9453,0.0,0.0,0.0,10.0);
}
}
}
}
return 1;
}
stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i)==vehicleid)
return 1;
}
}
return 0;
}
ai tens a funcao que verifica
pawn Код:
|
if(vehicleid == Carro[random(20))
fazes um if tipo isto:
pawn Код:
|
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pTrazerKart] == 1)
{
new vehicleidx = GetPlayerVehicleID(i);
if(!vehicleidx && Carro[random(2)])
{
SetPlayerInterior(i,0);
PutPlayerInVehicle(i, Carro[random(2)], 0);
Jogadoreskart++;
EVENTO[i] = 1;
SetPlayerRaceCheckpoint(i,1,-1341.8914,-671.3342,1055.9453,0.0,0.0,0.0,10.0);
}
}
}
}
return 1;
}
stock IsVehicleOccupied(vehicleid)
{
for(new zPT = 0; zPT < MAX_PLAYERS; zPT++)
{
if(IsPlayerInAnyVehicle(zPT))
if(GetPlayerVehicleID(zPT) == vehicleid)
return 1; // retorna 1 caso esteja
}
return 0; // retorna 0 caso nao esteja
}
if(variavel dos carros do evento)
{
if(!IsVehicleOccupied(carroid))
PutPlayerInVehicle(playerid, carroid, 0);
}