SA-MP Forums Archive
[HELP] /v Lock? - 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] /v Lock? (/showthread.php?tid=228187)



[HELP] /v Lock? - 01 - 19.02.2011

pawn Код:
}
            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;
                }
            }
Its not Locked?


Re: [HELP] /v Lock? - YungGee - 19.02.2011

Use SetVehicleParamsForPlayer and SetVehicleParamsForAll? "arInfo[keycar][cLock] = w/e" is just to tell it when to use those functions or not...