SA-MP Forums Archive
Vehicle Lock/Unlock System - 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: Vehicle Lock/Unlock System (/showthread.php?tid=274889)



Vehicle Lock/Unlock System - xXGaryXx - 07.08.2011

Hi I have a little problem...
If I lock my vehicle a little bit later it will be unlocked. you are not sure if it is unlocked or if it is locked. when you go to the car and try to go into it you sometimes notice that its unlocked. then you try to lock it: Vehicle unlocked. What the fuck?! Then you try it again: Vehicle locked. And now it's really locked. I know this is hard to understand however... here is my code:

pawn Код:
else if (strcmp("/carlock", cmd, true, 10) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!tmp[0])
        {
            format(tmp, 128, "Verwendung: /carlock [0 - %d]", Max_Player_Cars-1);
            SendClientMessage(playerid, COLOR_WHITE, tmp);
            return true;
        }
        new i = strval(tmp);
        if (Carlist[playerid][i][Typ]!=-1)
        {
            if (Carlist[playerid][i][Carid]!=-1)
            {
                if (Carlist[playerid][i][Lock]==0)
                {
                    Carlist[playerid][i][Lock]=1;
                    SetVehicleParamsForAll(Carlist[playerid][i][Carid],0,1);
                    SetVehicleParamsForPlayer(Carlist[playerid][i][Carid],playerid,0,1);
                    SendClientMessage(playerid, COLOR_RED, "Vehicle locked");
                }
                else
                {
                    Carlist[playerid][i][Lock]=0;
                    SetVehicleParamsForAll(Carlist[playerid][i][Carid],0,0);
                    SendClientMessage(playerid, COLOR_RED, "Vehicle unlocked");
                }
            }
            else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt zur Zeit kein Auto auf diesen Slot!"); }
        }
        else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Auto auf diesen Slot!"); }
        return 1;
    }



Re: Vehicle Lock/Unlock System - [MG]Dimi - 07.08.2011

tmp = strtok(cmdtext, idx);
if(!tmp[0])
{
format(tmp, 128, "Verwendung: /carlock [0 - %d]", Max_Player_Cars-1);

Im too bored to read whole code but you assigned same variable for messgae and for cmd param


AW: Vehicle Lock/Unlock System - xXGaryXx - 09.08.2011

i changed it but it doesn't work. the problem is if the car gets out auf my streamarea it will automaticly be unlocked. so if i go back i can get in the car although it should be locked... PLS HELP!


AW: Vehicle Lock/Unlock System - xXGaryXx - 11.08.2011

up // Theres no solution yet


Re: Vehicle Lock/Unlock System - =WoR=Varth - 12.08.2011

Use SetVehicleParamsEx


Re : Vehicle Lock/Unlock System - jasonnw666 - 13.08.2011

create a file for each vehicle id and a value "locked"=1 or 0