Can Any One fix /v lock of revans rp
#1

hi Guyz i need help i stuck in 1 prob in revans script /v lock is not working
i want to make it like when i /v lock my car then no 1 can enter in it doors will ge locked can any one code it for me just putting a code of /v lock

In Forward
Код:
forward LockCar(carid);
forward UnLockCar(carid);
forward InitLockDoors(playerid);
In new
Код:
new gCarLock[265];
enum cInfo
Код:
cLock,
Код:
LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    TextDrawShowForPlayer(playerid,txtAnimHelper);
}
Код:
OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    if (gPlayerUsingLoopingAnim[playerid] == 1) TextDrawHideForPlayer(playerid,txtAnimHelper);
	ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
	animation[playerid]++;
}
Код:
	if(IsAnOwnableCar(newcar))
		{
			if(PlayerInfo[playerid][pPcarkey] == newcar) { CanTurnEngine[playerid] = newcar; }
			else if(PlayerInfo[playerid][pPcarkey2] == newcar) { CanTurnEngine[playerid] = newcar; }
			else
			{
			    if(PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1)
				{
				    SendClientMessage(playerid, COLOR_GREY, "  You can drive this car because you are admin on duty !");
				}
			    else
			    {
					if(CarInfo[newcar][cLock] == 1)
					{
				        CanTurnEngine[playerid] = 9999;
				    	TogglePlayerControllable(playerid, 0);
				    	if(PlayerInfo[playerid][pDecoder] == 1)
				    	{
				    	    SendClientMessage(playerid, COLOR_GREY, "You can use your decoder with /decode");
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY,"* Car is not locked so you can start the engine!");
					    CanTurnEngine[playerid] = newcar;
					}
				}
			}
			if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Ownable Car");
		}
Код:
public LockCar(carid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			SetVehicleParamsForPlayer(carid,i,1,1);
			
		}
	}
}

public UnLockCar(carid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(!IsAPlane(carid))
			{
				SetVehicleParamsForPlayer(carid,i,0,0);
			}
		}
	}
}

public InitLockDoors(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		new c;
		while (c < 254)
		{
			c++;
			if (gCarLock[c] == 1)
			{
				SetVehicleParamsForPlayer(c,playerid,0,1);
			}
		}
	}
	return 1;
}
Код:
else if(strcmp(x_nr,"lock",true) == 0)
	        {
                new keycar = PlayerInfo[playerid][pPcarkey];
                if(keycar != 9999)
                {
                    new Float:X,Float:Y,Float:Z;
                    GetVehiclePos(keycar,X,Y,Z);
					if(IsPlayerInRangeOfPoint(playerid, 25,X,Y,Z))
					{
	                    new locked[128];
	                    locked = strtok(cmdtext, idx);
	                    if(CarInfo[keycar][cLock] == 1)
	                    {
							format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
							GameTextForPlayer(playerid, string, 4000, 3);
							CarInfo[keycar][cLock] = 0;
							OnPropUpdate(4,keycar);
							return 1;
						}
						else if(CarInfo[keycar][cLock] == 0)
						{
							format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
							GameTextForPlayer(playerid, string, 4000, 3);
							CarInfo[keycar][cLock] = 1;
							OnPropUpdate(4,keycar);
							return 1;
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY,"* You must be Near or in Your car to lock it!");
					    return 1;
					}
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1");
                    return 1;
                }
	        }
	        else if(strcmp(x_nr,"lock2",true) == 0)
	        {
                new keycar = PlayerInfo[playerid][pPcarkey2];
                if(keycar != 9999)
                {
                    new Float:X,Float:Y,Float:Z;
                    GetVehiclePos(keycar,X,Y,Z);
					if(IsPlayerInRangeOfPoint(playerid, 25,X,Y,Z))
					{
	                    new locked[128];
	                    locked = strtok(cmdtext, idx);
	                    if(CarInfo[keycar][cLock] == 1)
	                    {
							format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
							GameTextForPlayer(playerid, string, 4000, 3);
							CarInfo[keycar][cLock] = 0;
							OnPropUpdate(4,keycar);
							return 1;
						}
						else if(CarInfo[keycar][cLock] == 0)
						{
							format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
							GameTextForPlayer(playerid, string, 4000, 3);
							CarInfo[keycar][cLock] = 1;
							OnPropUpdate(4,keycar);
							return 1;
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY,"* You must be Near or in Your car to lock it!");
					    return 1;
					}
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "  You don't have a vehicle at slot 2");
                    return 1;
                }
	        }
if u dont understand then plz add me on skype then ill give u script skype is : asfand.shah3
Reply
#2

Use SetVehicleParamsEx

https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Reply
#3

i checked it but dont know how to fix it can any body help me
Reply
#4

Does the server have a '/v lock' command?

If so, then change these!

Код:
public LockCar(carid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			SetVehicleParamsForAll(carid,i,1,1);
			
		}
	}
}

public UnLockCar(carid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(!IsAPlane(carid))
			{
				SetVehicleParamsForAll(carid,i,0,0);
			}
		}
	}
}
Reply
#5

Oh, sorry for double posting, but I fucked up the script.
Here's the correct one!

Код:
public LockCar(carid)
{
	new engine, lights, alarm, doors, bonnet, boot, objective;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			GetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
			doors = 1;
			SetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
		}
	}
}

public UnLockCar(carid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(!IsAPlane(carid))
			{
				GetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
				doors = 0;
				SetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
			}
		}
	}
}
Reply
#6

Код:
public LockCar(carid)
{
	new engine, lights, alarm, doors, bonnet, boot, objective;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			GetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
			doors = 1;
			SetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
		}
	}
}

public UnLockCar(carid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(!IsAPlane(carid))
			{
				GetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
				doors = 0;
				SetVehicleParamsEx(engine, lights, alarm, doors, bonnet, boot, objective);
			}
		}
	}
}
IT Show Warnings and when i try it its not working Warnings is here:

Код:
C:\DOCUME~1\OWN\INTENS~1.PWN(17517) : warning 202: number of arguments does not match definition
C:\DOCUME~1\OWN\INTENS~1.PWN(17519) : warning 202: number of arguments does not match definition
C:\DOCUME~1\OWN\INTENS~1.PWN(17533) : warning 202: number of arguments does not match definition
C:\DOCUME~1\OWN\INTENS~1.PWN(17535) : warning 202: number of arguments does not match definition
ant atfer loccar and unlockcar there is this also
Код:
public InitLockDoors(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		new c;
		while (c < 254)
		{
			c++;
			if (gCarLock[c] == 1)
			{
				SetVehicleParamsForPlayer(c,playerid,0,1);
			}
		}
	}
	return 1;
}
Reply
#7

Plz check it i need help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)