SA-MP Forums Archive
[REP++] Respawn cars cmd - 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: [REP++] Respawn cars cmd (/showthread.php?tid=647034)



[REP++] Respawn cars cmd - maksicnm - 28.12.2017

Here is the COMMAND:
Код HTML:
YCMD:rac(playerid, params[], help)
{
	#pragma unused help
    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""ZELENA"[SE] "BELA"Moras se ulogovati da bi koristio ovu komandu!");
	if(PlayerInfo[playerid][xAdmin] < 6) return SCM(playerid, -1, ""ZELENA"[SE:RPG] "BELA"Samo Vlasnik.");
    if(AdminDuty[playerid] == 0) return SCM(playerid,-1,""ZELENA"[SE:RPG] "BELA"Morate biti na admin duznosti!");
	if(RespawnVozila == 1) return SCM(playerid, -1, ""CRVENA"[GRESKA] "BELA"Respawn je vec pokrenut!");
	new string2[32];
	if(sscanf(params, "s[32]", string2)) return SCM(playerid,-1,""ZELENA"[koriscenje] | "BELA"/rac ["ZELENA"privatna "BELA"| "ZELENA"sva"BELA""BELA"]");
	if(!strcmp(string2, "privatna"))
	{
		if(RespawnVozila == 1) return SCM(playerid, -1, ""CRVENA"[GRESKA] "BELA"Respawn je vec pokrenut!");
		new string[512]; RespawnVozila = 1;
		format(string,sizeof string, ""CRVENA"[!] "BELA"%s %s je pokrenuo respawn "CRVENA"privatnih "BELA"vozila za 20s!", GetName(playerid));
		SendClientMessageToAll(-1, string);
		SendClientMessageToAll(-1, ""CRVENA"[!] "BELA"Udjite u svoje vozilo da se ne respawna!");
		SetTimer("pRespawn", 20000, false);
		RespawnVozila = 1;
	}
	else if(!strcmp(string2, "sva"))
	{
		if(RespawnVozila == 1) return SCM(playerid, -1, ""CRVENA"[GRESKA] "BELA"Respawn je vec pokrenut!");
		new string[512]; RespawnVozila = 1;
		format(string,sizeof string, ""CRVENA"[!] "BELA"%s %s je pokrenuo respawn "CRVENA"svih "BELA"vozila za 20s!", GetName(playerid));
		SendClientMessageToAll(-1, string);
		SendClientMessageToAll(-1, ""CRVENA"[!] "BELA"Udjite u svoje vozilo da se ne respawna!");
		SetTimer("Respawn", 20000, false);
	}
	return 1;
}
Here is the public for "sva" strcmp
Код HTML:
forward Respawn();
public Respawn()
{
	new bool:unwanted[MAX_VOZILA];
	for(new player=0; player<MAX_PLAYERS; player++)
	{
		if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
	}
	for(new car = 1; car < MAX_VOZILA; car++)
	{
		if(!unwanted[car]) SetVehicleToRespawn(car);
	}
	RespawnVozila = 0; SendClientMessageToAll(-1, ""CRVENA"[!] "BELA"Vozila respawnovana!");
	return 1;
}
So when i do /rac privatna, all works, but when i type /rac sva, scrip freeze and falls down..