SA-MP Forums Archive
[Help] Command - 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: [Help] Command (/showthread.php?tid=137447)



[Help] Command - [Sk]Noob - 28.03.2010

Hello,
I am using the following car system:
http://forum.sa-mp.com/index.php?topic=160633.0

I edited it to my GM and i have this command

if the player owns the car it will turn on the engine and if he dont, it wont.

Any ways i got the public vehicles on the GM too (LSPD,EMT,ETC..) and they're not buyable so when i try to /engine it says i dont own the vehicle. How can i fix it ?

Код:
if(strcmp(cmd, "/engine", true) == 0)
	{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
		if(!strmatch(VehicleSystem[GetCreatorID(vehicleid)][owner],Spielername(playerid)))
		{
		SendClientMessage(playerid,COLOR_VEH,"This is not your car!");
		return 1;
		}
 		if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
			{
			TogglePlayerControllable(playerid,1);
			EngineStatus[GetPlayerVehicleID(playerid)] = 1;
			if(PlayerInfo[playerid][pSex] == 1)
			{
			PlayerActionMessage(playerid,15.0,"turns on his vehicle's engine.");
			}
			else
			{
			PlayerActionMessage(playerid,15.0,"turns on her vehicle's engine.");
			}
			}
			else
			{
			TogglePlayerControllable(playerid,0);
			EngineStatus[GetPlayerVehicleID(playerid)] = 0;
			if(PlayerInfo[playerid][pSex] == 1)
				{
	  			PlayerActionMessage(playerid,15.0,"turns off his vehicle's engine.");
	  			}
	  			else
	  			{
				PlayerActionMessage(playerid,15.0,"turns off her vehicle's engine.");
	  			}
			}
		}
		else
		{
   	SendClientMessage(playerid,COLOR_VEH,"You are not in a car!");
		}
		return 1;
		}



Re: [Help] Command - RyDeR` - 28.03.2010

Create an extra variable as boolean. Then use true ol false in your code..


Re: [Help] Command - [Sk]Noob - 28.03.2010

whats boolean ? lol i dont understand english very good..


Re: [Help] Command - Nero_3D - 28.03.2010

That would be a boolean variable (maybe check the sa-mp wiki, too)

pawn Код:
new bool:variable;

But I got a good suggestion

Let the script where it was and use it like it was as filterscript
I dont see the use of implanting other codes if there is the easier way