04.06.2013, 06:26
Hi, so here's the code :
You type command "/loadcrates" when you allready in a car
.
It should move 10 "wguns"
It does remove the "wguns" from the "hCar" but it wont fill the "Pcar" with "wguns"
I'm 99% precenet sure the probem is
Because I'm in a vehicle already and the "NearestVehicleToPlayer" is the car im driving at.
Any ideas? Thanks !!!
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;
}
pawn Код:
"hCar"
It should move 10 "wguns"
pawn Код:
comps[Pcar][wguns] += 10;
comps[hCar][wguns] += -10;
I'm 99% precenet sure the probem is
pawn Код:
new Pcar = GetPlayerNearestVehicle(playerid);
if(GetDistanceFromPlayerToVehicle(playerid, Pcar) > 8.0)
Any ideas? Thanks !!!