AVS Problem
#1

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

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

Still the same problem (
Anyone ?
Reply
#4

GetVehicleID seems like a pretty useless function ><
Reply
#5

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

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

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

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

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

I suggest you read some more basic tutorials, first.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)