you can't access vehicle
#1

hello guys here onplayerentervehicle
i have some code in server after 1,2 hours when i do /v [car] and try to sit in that car
it says You can't access this vehicle
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
vid GetPVarInt(playerid"LastVehicle");
    
lganim[playerid] = false;
    if (
ispassenger == 0) {
        for(new 
ii<MAX_PLAYERSi++)
        {
            if ((
plockedveh[playerid] != vehicleid && lockedveh[vehicleid] == 1) || (vorgo[vehicleid] != && vorgo[vehicleid] != GetPVarInt(playerid"playerorg") && (adlvl[playerid] < && olvl[playerid] < 1)) || (vehstored[vehicleid] != -&& PlayerVehicle(playeridvehicleid) == -1) || (plockedv[i][vehicleid] ==&& != playerid))
            {
                
SendClientMessage(playeridCOLOR_RED"You can't access this vehicle.");
                
ClearAnimations(playerid);
                return 
1;
            }
        }
 }
CMD:v(playeridparams[])
{
    return 
cmd_vehicle(playeridparams);
}
CMD:vehicle(playeridparams[])
{
    new 
tmp[256], idstring[256], giveplayerid;
    if(!
IsPlayerAdmin(playerid) && adlvl[playerid] < && olvl[playerid] ==&& elvl[playerid] == 0) return 0;
    if (
vehiclemodels >= MAX_VEHICLE_MODELS) return SendClientMessage2(playeridCOLOR_RED"Error: Vehicle model limit reached.");
    if (
GetMaxVehicles() == VEHICLES-PLAYERS) return SendClientMessage2(playeridCOLOR_RED"Error: Vehicle limit reached.");
    if(
sscanf(params"s[128]"tmp)) return SendClientMessage2(playeridCOLOR_WHITE"Usage: /v [model / name]");
    if(
isNumeric(tmp)) id strval(tmp);
    else
    {
        new 
vcount 0ovtl[5];
        for (new 
0212d++)
        {
            if (
strfind(vehName[d], tmptrue) != -|| strval(tmp) == d+400)
            {
                
id d+400;
                if (
vcount 5ovtl[vcount] = id;
                else return 
SendClientMessage2(playeridCOLOR_RED"Error: More than 5 results with that name were found.");
                
vcount ++;
            }
        }
        if (
vcount 1)
        {
            for (new 
0vcounte++)
            {
                if (
== 0SendClientMessage2(playeridCOLOR_LBLUE"Results..");
                
format(string64" %s (Model - %d)."vehName[ovtl[e]-400], ovtl[e]);
                
SendClientMessage2(playeridCOLOR_WHITEstring);
                if (
== vcount-1SendClientMessage2(playeridCOLOR_WHITE"");
            }
            return 
1;
        }
    }
    if (
id 400 || id 611) return SendClientMessage2(playeridCOLOR_ORANGE"Usage: /changecar [model / name]");
    new 
Float:xFloat:yFloat:zFloat:a;
    if (
spectat[playerid] != -1)
    {
        if (
IsPlayerInAnyVehicle(spectat[playerid]))
        {
            
GetVehiclePos(GetPlayerVehicleID(spectat[playerid]), xyz);
            
GetVehicleZAngle(GetPlayerVehicleID(spectat[playerid]), a);
        }
        else
        {
            
GetPlayerPos(spectat[playerid], xyz);
            
GetPlayerFacingAngleFix(spectat[playerid], a);
        }
    }
    else
    {
        if (
IsPlayerInAnyVehicle(playerid))
        {
            
GetVehiclePos(GetPlayerVehicleID(playerid), xyz);
            
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        }
        else
        {
            
GetPlayerPos(playeridxyz);
            
GetPlayerFacingAngleFix(playerida);
        }
    }
    
+= floatsin(-adegrees) * 5.0;
    
+= floatcos(-adegrees) * 5.0;
    
giveplayerid CreateVehicle2(idxyza+90.0, -1);
    
LinkVehicleToInterior2(giveplayeridGetPlayerInterior(playerid));
    
SetVehicleVirtualWorld(giveplayeridGetPlayerVirtualWorld(playerid));
    
svtd[giveplayerid] = true;
    
lockedveh[giveplayerid] = 0;
    
format(string128"You have spawned a %s (Model - %d) (ID - %d)."vehName[id-400], idgiveplayerid);
    
SendClientMessage2(playeridCOLOR_WHITEstring);
    return 
1;

i hope you guys will help me
Reply
#2

bump
Reply
#3

anyone
Reply
#4

So you are trying to make this posaible for only 2 hours and then destroy the car or what?
Reply
#5

bro i want this sytem work smoothly
like after some minutes when i do /v car then i press enter that's says you can't acceess vehicle
i dont know why
but when i spawn 5 times the same car then it works perfectly for 2-3 cars then again it starts saying you can't access vehicle
i need you to help me to fix the bug.
Reply
#6

PHP код:
if ((plockedveh[playerid] != vehicleid && lockedveh[vehicleid] == 1) || (vorgo[vehicleid] != && vorgo[vehicleid] != GetPVarInt(playerid"playerorg") && (adlvl[playerid] < && olvl[playerid] < 1)) || (vehstored[vehicleid] != -&& PlayerVehicle(playeridvehicleid) == -1) || (plockedv[i][vehicleid] ==&& != playerid)) 
If anything it'll be this if statement, it's likely that it's not a time based thing, and that it's a condition check error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)