SA-MP Forums Archive
How I make a Command to 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How I make a Command to Respawn (/showthread.php?tid=101009)



How I make a Command to Respawn - alex1a - 07.10.2009

I How make a command to respawn vehicles


Re: How I make a Command to Respawn - Rickyboy30 - 07.10.2009

Hehe, Just added it in my GF editted one:
here you go ( You'v to add a admin line if you want to make it a admin command) :

Put this at your command thing shit, *Forgot the name
Код:
	if(strcmp(cmd, "/respawnall", true) == 0 || strcmp(cmd, "/respvehs", true) == 0)
	{

		for(new i=0;i<MAX_VEHICLES;i++)
		{
		if(IsVehicleOccupied(i) == 0)
  			{
   			SetVehicleToRespawn(i);
		  }
		}
			SendClientMessage(playerid, 0xAFAFAFAA, "* 		All unoccupied vehicles respawned!!");
		 	return 1;
	}
Put this on the top or bottom of your script:
Код:
forward IsVehicleOccupied(vehicleid);
public IsVehicleOccupied(vehicleid)
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerInVehicle(i,vehicleid)) return 1;
	}
	return 0;
}



Re: How I make a Command to Respawn - brett7 - 07.10.2009

but you only need 1 loop


Re: How I make a Command to Respawn - MartinDaniel - 08.10.2009

C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(366) : error 017: undefined symbol "cmd"

How i fix it please ?


Re: How I make a Command to Respawn - Hiitch - 08.10.2009

Quote:
Originally Posted by MartinDaniel
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(366) : error 017: undefined symbol "cmd"

How i fix it please ?
new cmd;

or new cmd[128];

if you get the error saying that the destination array is too small, then change the 128 to 256.

so : new cmd[256]; (I think if this was using the strtok, it would require a 256, as my gamemode does as well.)


Re: How I make a Command to Respawn - MartinDaniel - 08.10.2009

C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(373) : warning 204: symbol is assigned a value that is never used: "cmd"

And i still got the same error...Help, please.


Re: How I make a Command to Respawn - alex1a - 08.10.2009

Thanks a lot, but How add the permissions only to admins to use that command


Re: How I make a Command to Respawn - alex1a - 08.10.2009

",true)==0&&IsPlayerAdmin(playerid)==1)

LOL
Nevermind