How I make a Command to Respawn
#1

I How make a command to respawn vehicles
Reply
#2

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;
}
Reply
#3

but you only need 1 loop
Reply
#4

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

How i fix it please ?
Reply
#5

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.)
Reply
#6

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.
Reply
#7

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

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

LOL
Nevermind
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)