[HELP] About reset cars
#1

Hello I need to ask something,
I want to do a command it reset cars with but it's need to reset unused cars how can I do it?
Reply
#2

pawn Код:
CMD:respawncars(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;//if the player is not an admin.
new string[120];//the string used to format messages
format(string,sizeof(string),"[ADMIN] Admin %s[%d] has respawned all the UnOccuiped cars",GetName(playerid),playerid);//we will format the message
SendClientMessageToAll(COLOR_RED,string);//then we will send it to everyone online
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
return 1;
}
getname function:
put it anywhere in your gamemode:
pawn Код:
stock GetName(playerid)
{
    new pName[68];
    GetPlayerName(playerid, (pName), sizeof(pName));
    return pName;
}
Reply
#3

Quote:
Originally Posted by Eth
Посмотреть сообщение
pawn Код:
CMD:respawncars(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;//if the player is not an admin.
new string[120];//the string used to format messages
format(string,sizeof(string),"[ADMIN] Admin %s[%d] has respawned all the UnOccuiped cars",GetName(playerid),playerid);//we will format the message
SendClientMessageToAll(COLOR_RED,string);//then we will send it to everyone online
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
return 1;
}
getname function:
put it anywhere in your gamemode:
pawn Код:
stock GetName(playerid)
{
    new pName[68];
    GetPlayerName(playerid, (pName), sizeof(pName));
    return pName;
}
thanks it's works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)