SA-MP Forums Archive
Lockabale car - 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: Lockabale car (/showthread.php?tid=84148)



Lockabale car - sggassasin - 29.06.2009

hi i was woundering if someone could help with an Lockabale car than can be locked and unlocked so pepole carnt get in it a little help plz


Re: Lockabale car - [HiC]TheKiller - 29.06.2009

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer


Re: Lockabale car - Burridge - 29.06.2009

pawn Код:
if (strcmp(cmdtext, "/lock", true)==0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
                return SendClientMessage(playerid,COLOR_GREEN,"You can only lock the doors as the driver.");

            new i;
            for(i=0;i<MAX_PLAYERS;i++)
            {
                if(i != playerid)
                    SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
            }

            SendClientMessage(playerid, COLOR_GREEN, "Vehicle locked!");

            new Float:pX, Float:pY, Float:pZ;
            GetPlayerPos(playerid,pX,pY,pZ);

            PlayerPlaySound(playerid,1056,pX,pY,pZ);
        }
        else
            SendClientMessage(playerid, COLOR_GREEN, "You're not in a vehicle!");

        return 1;
    }

    if (strcmp(cmdtext, "/unlock", true)==0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
                return SendClientMessage(playerid,COLOR_GREEN,"You can only unlock the doors as the driver.");

            new i;
            for(i=0;i<MAX_PLAYERS;i++)
                SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);

            SendClientMessage(playerid, COLOR_GREEN, "Vehicle unlocked!");
            new Float:pX, Float:pY, Float:pZ;
            GetPlayerPos(playerid,pX,pY,pZ);
            PlayerPlaySound(playerid,1057,pX,pY,pZ);
        }
        else
            SendClientMessage(playerid, COLOR_GREEN, "You're not in a vehicle!");

        return 1;
    }
Yes it works.