[zcmd] respawn
#1

does anyone have a zcmd command for /vrespawn, it respawns all cars but if someone is in their vehicle, it doesnt respawn
Reply
#2

Quote:
Originally Posted by Jordiee
Посмотреть сообщение
does anyone have a zcmd command for /vrespawn, it respawns all cars but if someone is in their vehicle, it doesnt respawn
Try this

Код:
CMD:vrespawn(playerid, params[])
{
	if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
	new bool:vehicleused[MAX_VEHICLES];
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
			vehicleused[GetPlayerVehicleID(i)] = true;
		}
	}
	for(new i=1; i < MAX_VEHICLES; i++)
	{
		if(!vehicleused[i])
		{
			SetVehicleToRespawn(i);
		}
	}
	new msg[128];
	format(msg, sizeof(msg), "Admin %s (%d) has respawned all unused vehicles", PlayerName(playerid), playerid);
	SendClientMessageToAll(COLOR_YELLOW, msg);
	return 1;
}
Reply
#3

There is nothing like
pawn Код:
if(!IsAdmin(playerid, 1))
And
pawn Код:
PlayerName(playerid)
at Jordiee's code. I suggest you to look the code before post something (code)
Sarma93's code with some changes.
pawn Код:
CMD:vrespawn(playerid, params[])
{
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
    new
        bool:vehicleused[MAX_VEHICLES];
    for (new i=0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) {
            vehicleused[GetPlayerVehicleID(i)] = true;
        }
    }
    for (new i=1; i < MAX_VEHICLES; i++) {
        if(!vehicleused[i]) {
            SetVehicleToRespawn(i);
        }
    }
    return 1;
}
Reply
#4

None of them work, the variable is [pAdmin]
Reply
#5

Quote:
Originally Posted by Jordiee
Посмотреть сообщение
None of them work, the variable is [pAdmin]
Look carefully!
pawn Код:
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
It's for Rcon Administrator.
Change it in whatever you are using as variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)