SA-MP Forums Archive
/lock - 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)
+--- Thread: /lock (/showthread.php?tid=414579)



/lock - DerickClark - 09.02.2013

Hi. i have a /lockcar.how to make it like if you go in a car you type /lockcar and get out of the car you can't go back in it.i wanna it auto opens.


Here my Code:


Код:
CMD:lock(playerid, params[])
{
	#pragma unused params
	{//Dont Remove dis.
	    if(IsPlayerInAnyVehicle(playerid))
		{
		 	 for(new i = 0; i < MAX_PLAYERS; i++)
			 SetCarLockedState(GetPlayerVehicleID(playerid),i,false,true);
			 SendClientMessage(playerid,SUCCESS,"Your car has been locked!");
			 return 1;
		}
		else return SendClientMessage(playerid,COLOR_ERROR,"ERROR: You need to be in a vehicle");
	}
}

CMD:unlock(playerid, params[])
{
	#pragma unused params
    if(IsPlayerAdmin(playerid)) {//Don't Remove dis.
	    if(IsPlayerInAnyVehicle(playerid))
		{
		 	for(new i = 0; i < MAX_PLAYERS; i++)
		  	SetCarLockedState(GetPlayerVehicleID(playerid),i,false,false);
		  	SendClientMessage(playerid,SUCCESS,"Your car has been unlocked!");
		  	return 1;
		}
		else return SendClientMessage(playerid,COLOR_ERROR,"ERROR: You need to be in a vehicle to unlock your veh.");
	}
}