Vehicle Lock/Unlock System
#1

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;
    }
Reply
#2

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
Reply
#3

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!
Reply
#4

up // Theres no solution yet
Reply
#5

Use SetVehicleParamsEx
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)