SA-MP Forums Archive
Lock door - 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: Lock door (/showthread.php?tid=106752)



Lock door - _Healer_ - 05.11.2009

Guys i want a System for Car
/lock - Car Locked
/unlock - Car Unlocked

and if you can Script for House system in Lv



Re: Lock door - _Healer_ - 05.11.2009

pls guys i want answear


Re: Lock door - The_Pain - 05.11.2009

Here you are
http://www.MegaShare.com/1591602
http://pastebin.com/f1cccf318


Re: Lock door - Avsecret - 05.11.2009

Add the following to your OnPlayerCommandText section
Код:
new vehicleid = GetPlayerVehicleID(playerid);
if (strcmp(cmdtext, "/lock", true)==0)
		{
			if(IsPlayerInAnyVehicle(playerid))
			{
				new State=GetPlayerState(playerid);
				if(State!=PLAYER_STATE_DRIVER)
				{
					SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
					return 1;
				}
				new i;
				for(i=0;i<MAX_PLAYERS;i++)
				{
					if(i != playerid)
					{
						SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
					}
				}
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "* %s just locked his/her car.", sendername);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!");
		  	new Float:pX, Float:pY, Float:pZ;
				GetPlayerPos(playerid,pX,pY,pZ);
				PlayerPlaySound(playerid,1056,pX,pY,pZ);
				locked[playerid][GetPlayerVehicleID(playerid)] = 1;
			}
			else
			{
			SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
			}
			return 1;
			}

	if (strcmp(cmdtext, "/unlock", true)==0)
		{
			if(IsPlayerInAnyVehicle(playerid))
			{
				new State=GetPlayerState(playerid);
				if(State!=PLAYER_STATE_DRIVER)
				{
					SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
					return 1;
				}
				new i;
				for(i=0;i<MAX_PLAYERS;i++)
				{
					SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
				}
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "* %s just unlocked his/her car.", sendername);
				ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!");
				new Float:pX, Float:pY, Float:pZ;
				GetPlayerPos(playerid,pX,pY,pZ);
				PlayerPlaySound(playerid,1057,pX,pY,pZ);
				locked[playerid][GetPlayerVehicleID(playerid)] = 0;
			}
			else
			{
				SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
			}
			return 1;
			}
From The Underworld Script.
Enjoy


Re: Lock door - _Healer_ - 06.11.2009

Thank you guys for help and Script Work