SA-MP Forums Archive
[Help]: Last Step On Script Help! - 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: [Help]: Last Step On Script Help! (/showthread.php?tid=245057)



[Help]: Last Step On Script Help! - [MKD]Max - 29.03.2011

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!


Re: [Help]: Last Step On Script Help! - [NRP]Blade - 29.03.2011

Show us the OnPlayerEnterVehicle


Re: [Help]: Last Step On Script Help! - [MKD]Max - 29.03.2011

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


Re: [Help]: Last Step On Script Help! - [MKD]Max - 29.03.2011

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


Re: [Help]: Last Step On Script Help! - SchurmanCQC - 29.03.2011

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


Re: [Help]: Last Step On Script Help! - [NRP]Blade - 29.03.2011

Yea and use VehicleParams


Re: [Help]: Last Step On Script Help! - [MKD]Max - 29.03.2011

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


Re: [Help]: Last Step On Script Help! - Vince - 29.03.2011

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;
}