Lock Command Doesnt Work?
#1

This is the command. It only shows that it is locked for you, but not anybody else.

PHP Code:
command(lockplayeridparams[])
{
    new 
string[256];
    if(
Player[playerid][PlayerCarModel] > && IsPlayerInRangeOfVehicle(playeridPlayer[playerid][CarLinkID], 4))
    {
           if(
Player[playerid][CarLinkID] > 0)
           {
               if(
Player[playerid][LockedCar] == 0)
               {
                   
Player[playerid][LockedCar] = 1;
                   
format(stringsizeof(string), "* %s takes out their keys and locks their car."GetName(playerid));
                   
NearByMessage(playeridNICESKYstring);
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
== playerid)
                    {
                        
SetVehicleParamsForPlayer(Player[playerid][CarLinkID], i01);
                    }
                }
                return 
1;
            }
            else
            {
                
format(stringsizeof(string), "* %s takes out their keys and unlocks their car."GetName(playerid));
                   
NearByMessage(playeridNICESKYstring);
                
Player[playerid][LockedCar] = 0;
                for(new 
0MAX_PLAYERSi++)
                {
                    
SetVehicleParamsForPlayer(Player[playerid][CarLinkID], i00);
                }
                return 
1;
            }
        }
    }

Reply
#2

it should work, you maybe forgot to write stuff OnPlayerEnterVehicle
write something like this:
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(ispassenger == 0)
    {
if locked
{
GetPlayerPos(playerid,Float:LocX,Float:LocY,Float:LocZ);
            SetPlayerPos(playerid,Float:LocX,Float:LocY,Float:LocZ);
            SendClientMessage(playerid,COLOR_GREY,"( ! ) This vehicle is locked by the owner !");
}
}
}return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)