SA-MP Forums Archive
AVS Problem - 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)
+--- Thread: AVS Problem (/showthread.php?tid=376970)



AVS Problem - yLuSsSIoN - 12.09.2012

So as the tittle says i got a problem at AVS ( Advanced Vehicle System by Mademan) .
The problem is with the /vlock command.
Let's say i lock the car , it appears " Doors Locked" , so the command works fine , but if i go a bit further .. and return to my car , the car is unlocked automaticaly , someone know how to fix this problem ?


2. And i got 1 more problem. Only the admins can change the color , and the color command is in a dialog /editv ( Someone know how to fix this problem)? . Help pleaze


Lock command :
pawn Код:
CMD:vlock(playerid, params[])
{
    new vehicleid;
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        vehicleid = GetPlayerVehicleID(playerid);
    }
    else
    {
        vehicleid = GetClosestVehicle(playerid);
        if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
    }
    if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
    new id = GetVehicleID(vehicleid);
    if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    if(GetPlayerVehicleAccess(playerid, id) < 2)
        return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        doors = 0;
        VehicleLock[id] = 0;
        GameTextForPlayer(playerid, "~g~doors unlocked", 3000, 6 );
    }
    else
    {
        doors = 1;
        VehicleLock[id] = 1;
        GameTextForPlayer(playerid, "~r~doors locked", 3000, 6 );
    }
    SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SaveVehicle(id);
    return 1;
}

The whole AVS :
http://pastebin.com/zt3v7DZt


Can someone help me pleaze ?:d


Re: AVS Problem - clarencecuzz - 12.09.2012

pawn Код:
CMD:vlock(playerid, params[])
{
    new vehicleid;
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        vehicleid = GetPlayerVehicleID(playerid);
    }
    else
    {
        vehicleid = GetClosestVehicle(playerid);
        if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
    }
    if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
    new id = GetVehicleID(vehicleid);
    if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    if(GetPlayerVehicleAccess(playerid, id) < 2)
        return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
        VehicleLock[id] = 0;
        GameTextForPlayer(playerid, "~g~doors unlocked", 3000, 6 );
    }
    else
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
        VehicleLock[id] = 1;
        GameTextForPlayer(playerid, "~r~doors locked", 3000, 6 );
    }
    SaveVehicle(id);
    return 1;
}
NOTE: Untested


Re: AVS Problem - yLuSsSIoN - 12.09.2012

Still the same problem (
Anyone ?


Re: AVS Problem - mamorunl - 12.09.2012

GetVehicleID seems like a pretty useless function ><


Re: AVS Problem - yLuSsSIoN - 12.09.2012

I heard about a saving system or something to /vlock ...


Re: AVS Problem - mamorunl - 12.09.2012

pawn Код:
new id = GetVehicleID(vehicleid);
print a debug message with ID. I am curious to what it returns (also print vehicleid with it)


Re: AVS Problem - yLuSsSIoN - 12.09.2012

What did you say .. sry i'm a beginner scripter and i don't know english very good :d...


Re: AVS Problem - jameskmonger - 12.09.2012

Do printf("id: %d, %d", vehicleid, GetVehicleID(vehicleid));


Re: AVS Problem - yLuSsSIoN - 12.09.2012

So will you add this in my /vlock command , sry .. i am still try to learn this pawn language


Re: AVS Problem - jameskmonger - 12.09.2012

I suggest you read some more basic tutorials, first.