SA-MP Forums Archive
Can Someone Tell Me how to do this.. - 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: Can Someone Tell Me how to do this.. (/showthread.php?tid=153889)



Can Someone Tell Me how to do this.. - matthewdriftking - 11.06.2010

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?


Re: Can Someone Tell Me how to do this.. - DJDhan - 11.06.2010

Код:
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;
}



Re: Can Someone Tell Me how to do this.. - NewTorran - 11.06.2010

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 )


Re: Can Someone Tell Me how to do this.. - DJDhan - 11.06.2010

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


Re: Can Someone Tell Me how to do this.. - NewTorran - 11.06.2010

Yes you did,

IsVehicleOccupied


Re: Can Someone Tell Me how to do this.. - DJDhan - 11.06.2010

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


Re: Can Someone Tell Me how to do this.. - matthewdriftking - 11.06.2010

Please Post The Code Clearly!


Re: Can Someone Tell Me how to do this.. - matthewdriftking - 12.06.2010

*Bump*


Re: Can Someone Tell Me how to do this.. - DJDhan - 12.06.2010

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


Re: Can Someone Tell Me how to do this.. - matthewdriftking - 12.06.2010

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