GetPlayerNearestVehicle - While you in vehicle. prob.
#1

Hi, so here's the code :
pawn Код:
COMMAND:loadcrates(playerid, params[])
{
    new hCar = GetPlayerVehicleID(playerid);
    if(!comps[hCar][wguns]) return SendClientError(playerid, "You don't have any crates on your forklift.");
    new Pcar = GetPlayerNearestVehicle(playerid);
    if(GetDistanceFromPlayerToVehicle(playerid, Pcar) > 8.0)
    comps[Pcar][wguns] += 10;
    comps[hCar][wguns] += -10;
    DestroyObject(GetPVarInt(playerid, "harrycrate"));
    Action(playerid, "places the crate in the back of the van.");
    format(iStr, sizeof(iStr), "has loaded a crate in a back of a van.", PlayerName(playerid));
    iEcho(iStr);
    return 1;
}
You type command "/loadcrates" when you allready in a car
pawn Код:
"hCar"
.
It should move 10 "wguns"
pawn Код:
comps[Pcar][wguns] += 10;
comps[hCar][wguns] += -10;
It does remove the "wguns" from the "hCar" but it wont fill the "Pcar" with "wguns"

I'm 99% precenet sure the probem is
pawn Код:
new Pcar = GetPlayerNearestVehicle(playerid);
    if(GetDistanceFromPlayerToVehicle(playerid, Pcar) > 8.0)
Because I'm in a vehicle already and the "NearestVehicleToPlayer" is the car im driving at.

Any ideas? Thanks !!!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)