you can't access vehicle -
BulletRaja - 18.02.2018
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(playerid, vehicleid, ispassenger)
{
new vid = GetPVarInt(playerid, "LastVehicle");
lganim[playerid] = false;
if (ispassenger == 0) {
for(new i; i<MAX_PLAYERS; i++)
{
if ((plockedveh[playerid] != vehicleid && lockedveh[vehicleid] == 1) || (vorgo[vehicleid] != 0 && vorgo[vehicleid] != GetPVarInt(playerid, "playerorg") && (adlvl[playerid] < 5 && olvl[playerid] < 1)) || (vehstored[vehicleid] != -1 && PlayerVehicle(playerid, vehicleid) == -1) || (plockedv[i][vehicleid] ==1 && i != playerid))
{
SendClientMessage(playerid, COLOR_RED, "You can't access this vehicle.");
ClearAnimations(playerid);
return 1;
}
}
}
CMD:v(playerid, params[])
{
return cmd_vehicle(playerid, params);
}
CMD:vehicle(playerid, params[])
{
new tmp[256], id, string[256], giveplayerid;
if(!IsPlayerAdmin(playerid) && adlvl[playerid] < 3 && olvl[playerid] ==0 && elvl[playerid] == 0) return 0;
if (vehiclemodels >= MAX_VEHICLE_MODELS) return SendClientMessage2(playerid, COLOR_RED, "Error: Vehicle model limit reached.");
if (GetMaxVehicles() == VEHICLES-PLAYERS) return SendClientMessage2(playerid, COLOR_RED, "Error: Vehicle limit reached.");
if(sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /v [model / name]");
if(isNumeric(tmp)) id = strval(tmp);
else
{
new vcount = 0, ovtl[5];
for (new d = 0; d < 212; d++)
{
if (strfind(vehName[d], tmp, true) != -1 || strval(tmp) == d+400)
{
id = d+400;
if (vcount < 5) ovtl[vcount] = id;
else return SendClientMessage2(playerid, COLOR_RED, "Error: More than 5 results with that name were found.");
vcount ++;
}
}
if (vcount > 1)
{
for (new e = 0; e < vcount; e++)
{
if (e == 0) SendClientMessage2(playerid, COLOR_LBLUE, "Results..");
format(string, 64, " %s (Model - %d).", vehName[ovtl[e]-400], ovtl[e]);
SendClientMessage2(playerid, COLOR_WHITE, string);
if (e == vcount-1) SendClientMessage2(playerid, COLOR_WHITE, "");
}
return 1;
}
}
if (id < 400 || id > 611) return SendClientMessage2(playerid, COLOR_ORANGE, "Usage: /changecar [model / name]");
new Float:x, Float:y, Float:z, Float:a;
if (spectat[playerid] != -1)
{
if (IsPlayerInAnyVehicle(spectat[playerid]))
{
GetVehiclePos(GetPlayerVehicleID(spectat[playerid]), x, y, z);
GetVehicleZAngle(GetPlayerVehicleID(spectat[playerid]), a);
}
else
{
GetPlayerPos(spectat[playerid], x, y, z);
GetPlayerFacingAngleFix(spectat[playerid], a);
}
}
else
{
if (IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
else
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngleFix(playerid, a);
}
}
x += floatsin(-a, degrees) * 5.0;
y += floatcos(-a, degrees) * 5.0;
giveplayerid = CreateVehicle2(id, x, y, z, a+90.0, -1);
LinkVehicleToInterior2(giveplayerid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
svtd[giveplayerid] = true;
lockedveh[giveplayerid] = 0;
format(string, 128, "You have spawned a %s (Model - %d) (ID - %d).", vehName[id-400], id, giveplayerid);
SendClientMessage2(playerid, COLOR_WHITE, string);
return 1;
}
i hope you guys will help me
Re: you can't access vehicle -
BulletRaja - 18.02.2018
bump
Re: you can't access vehicle -
BulletRaja - 18.02.2018
anyone
Re: you can't access vehicle -
PepsiCola23 - 18.02.2018
So you are trying to make this posaible for only 2 hours and then destroy the car or what?
Re: you can't access vehicle -
BulletRaja - 18.02.2018
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.
Re: you can't access vehicle -
Sew_Sumi - 18.02.2018
PHP код:
if ((plockedveh[playerid] != vehicleid && lockedveh[vehicleid] == 1) || (vorgo[vehicleid] != 0 && vorgo[vehicleid] != GetPVarInt(playerid, "playerorg") && (adlvl[playerid] < 5 && olvl[playerid] < 1)) || (vehstored[vehicleid] != -1 && PlayerVehicle(playerid, vehicleid) == -1) || (plockedv[i][vehicleid] ==1 && i != 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.