SA-MP Forums Archive
[zcmd] respawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [zcmd] respawn (/showthread.php?tid=301162)



[zcmd] respawn - Jordiee - 03.12.2011

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


Re: [zcmd] respawn - Sarma93 - 03.12.2011

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;
}



Re: [zcmd] respawn - Kostas' - 03.12.2011

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;
}



Re: [zcmd] respawn - Jordiee - 03.12.2011

None of them work, the variable is [pAdmin]


Re: [zcmd] respawn - Kostas' - 03.12.2011

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.