[Help]: Last Step On Script Help!
#1

hello all i have made lock unlock commands!

pawn Код:
if(strcmp(cmd, "/lock", true)==0)
        {
        if(IsPlayerInAnyVehicle(playerid))
                {
            new State=GetPlayerState(playerid);
            if  (State!=PLAYER_STATE_DRIVER)
                {
                SendClientMessage(playerid,COLOR_RED,"You can only lock the doors as the driver.");
                return 1;
                }
            lockedCar[GetPlayerVehicleID(playerid)]=1;
            new i;
                for (i=0;i<MAX_PLAYERS;i++)
                    {
                        if(i != playerid)
                        {
                        SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
                        }
                    }
                SendClientMessage(playerid, COLOR_YELLOW, "Vehicle locked!");
                new Float:pX, Float:pY, Float:pZ;
                GetPlayerPos(playerid,pX,pY,pZ);
                PlayerPlaySound(playerid,1056,pX,pY,pZ);
                }
        else
            {
            SendClientMessage(playerid, COLOR_RED, "You're not in a vehicle!");
            }
        return 1;
        }
pawn Код:
if(strcmp(cmd, "/unlock", true)==0)
       {
       if(IsPlayerInAnyVehicle(playerid))
            {
            new State=GetPlayerState(playerid);
            if  (State!=PLAYER_STATE_DRIVER)
                {
                SendClientMessage(playerid,COLOR_RED,"You can only unlock the doors as the driver.");
                return 1;
                }
            new i;
            lockedCar[GetPlayerVehicleID(playerid)]=0;
            for (i=0;i<MAX_PLAYERS;i++)
                {
                SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
                }
            SendClientMessage(playerid, COLOR_YELLOW, "Vehicle unlocked!");
            new Float:pX, Float:pY, Float:pZ;
            GetPlayerPos(playerid,pX,pY,pZ);
            PlayerPlaySound(playerid,1057,pX,pY,pZ);
            }
        else
            {
            SendClientMessage(playerid, COLOR_RED, "You're not in a vehicle!");
            }
        return 1;
        }
now what i need i done from it it's all work no problems but when i use lock command i tell me
Vehicle Locked But other players can steal it from me and enter it like what they want how i can let them no enter my car while im locked it! thanks hope you will help me guys!
Reply
#2

Show us the OnPlayerEnterVehicle
Reply
#3

but i need help with onplayerEnterVehicle i dont know what to do under OnPlayerEnterVehicle!!! help!
Reply
#4

bump please you are pro scripter guys! help please it's my last step and i will done the gamemode!
Reply
#5

I can't even tell which statements relate to other statements, the indentation is bad.
Reply
#6

Yea and use VehicleParams
Reply
#7

omg this is not help where is all gone no body know how to script now!!!! Omg
Reply
#8

Just use SetVehicleParamsEx.
And also add this under OnVehicleStreamIn:
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(lockedCar[vehicleid])
    {
        new
            engine,lights,alarm,doors,bonnet,boot,objective;

        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)