[FilterScript] Very simple Lock Unlock system
#1

Hey all
I dont know what title to get on

Okay that simple Lock Unlock system

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	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);
					}
				}
				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;
			}
Like that
And unlock
Код:
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);
				}
				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;
			}
yeah...
Okay
You need click here To download it
Reply
#2

your upload is bad
source and fixed: http://pastebin.com/0jCPx1rc
I fixed becouse get eror:
Код:
C:\Documents and Settings\Sandu\Desktop\Untitled.pwn(1) : error 010: invalid function or declaration
C:\Documents and Settings\Sandu\Desktop\Untitled.pwn(3) : error 013: Unknown Directive
Reply
#3

thanks
Reply
#4

what are the keys to lock/unlock? or do you must type: /lock and /unlock?
Reply
#5

Quote:
Originally Posted by tvl1996
Посмотреть сообщение
what are the keys to lock/unlock? or do you must type: /lock and /unlock?
You must type it
Reply
#6

you must type /lock and /unlock no special key
Reply
#7

I am in the car and locked him, i can get out of the car. He isnt locked.....
And if im out of the car, i can get in the car.
Reply
#8

When you get in car you need to type /lock and no one will get it
When you want exit type /unlock and get out
If you get out without unlock the car will still locked...
Reply
#9

XD nice job
Reply
#10

Tnx dude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)