Can Someone Tell Me how to do this..
#1

Can some one tell me how can i respawn cars? i use AddStaticVehicle On my gamemode. Sry for my bad english but is there any cmd/code to make it?
Reply
#2

Код:
if(!strcmp(cmdtext,"/respawnvehicles,true,16))
{
	if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid,0xff0000aa,"You are not authorised to use this command");
	
	new adminname[56], string[128];
	GetPlayerName(playerid,adminname,sizeof(adminname));
	format(string,sizeof(string), "[ADMIN] %s has Respawned all Vehicles",adminname);
	for(new i=0; i<MAX_VEHICLES;i++)
	{
		if(!IsVehicleOccupied(i)
		{
			SetVehicleToRespawn(i);
		}
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by DJDhan
Код:
if(!strcmp(cmdtext,"/respawnvehicles,true,16))
{
	if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid,0xff0000aa,"You are not authorised to use this command");
	
	new adminname[56], string[128];
	GetPlayerName(playerid,adminname,sizeof(adminname));
	format(string,sizeof(string), "[ADMIN] %s has Respawned all Vehicles",adminname);
	for(new i=0; i<MAX_VEHICLES;i++)
	{
		if(!IsVehicleOccupied(i)
		{
			SetVehicleToRespawn(i);
		}
	}
	return 1;
}
Thats not going to work for him as you included a function that isent in the offical samp includes ( i think )
Reply
#4

Err, I didn't use any function that is non-native
Reply
#5

Yes you did,

IsVehicleOccupied
Reply
#6

Oh rite, You can just remove that if condition

Or add this:
Код:
forward IsVehicleOccupied(vehicleid);
public IsVehicleOccupied(vehicleid)
{
   for(new i=0;i<MAX_PLAYERS;i++)
   {
      if(IsPlayerInVehicle(i,vehicleid)) return 1;
   }
   return 0;
}
Thank you Torran
Reply
#7

Please Post The Code Clearly!
Reply
#8

*Bump*
Reply
#9

You have already got the answer, why are you bumping the topic?
Reply
#10

Quote:
Originally Posted by DJDhan
You have already got the answer, why are you bumping the topic?
I want one clearly!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)