PDA

View Full Version : /load command bugged?


Donvalley
21/06/2013, 02:36 AM
why does this command not work? tells me "You can only deliver in a truck" when i am in on of the ComTruck Vechiles.


//-----------------------------------------[Commerce Trucking]--------------------//
if(strcmp(cmd, "/load", true) == 0)
{
if(PlayerInfo[playerid][pJob] == 26)
{
if(PlayerInfo[playerid][pTruckerCooldown] <= 0)
{
if(GetPVarInt(playerid, "Delivering") == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 2484.2195,-2118.1204,13.5469))
{
if(GetPlayerVehicleID(playerid) >= ComTruck[0] && GetPlayerVehicleID(playerid) <= ComTruck[10])
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(p layerid)))
{
if(GetPVarInt(playerid, "Loading") == 0)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, LIGHTBLUE, "Please wait while the products are loaded onto the truck...");
SetTimerEx("LoadProducts", 10000, false, "i", playerid);
SetPVarInt(playerid, "Loading", 1);
TogglePlayerControllable(playerid, 0);
return 1;
}
else return SendClientMessage(playerid, GREY, "Please wait...");
}
else return SendClientMessage(playerid, GREY, "Wait.. where's the trailer? We need something to put the products inside.");
}
else return SendClientMessage(playerid, GREY, " You can only deliver in a truck.");
}
else return SendClientMessage(playerid, GREY, " You are not at the Los Santos Product Factory.");
}
else return SendClientMessage(playerid, GREY, " You are already delivering products, either deliver it or /killcp.");
}
else return format(string, sizeof(string), "You still have %d seconds left before you can deliver more products.", PlayerInfo[playerid][pTruckerCooldown]), SendClientMessage(playerid, GREY, string);
}
else { SendClientMessage(playerid, GREY, " You are not a trucker."); }
return 1;
}

Kindred
21/06/2013, 02:45 AM
You are finding if it is greater than or equal to that variable. It doesn't work like that (i think).

Check if they are EQUAL.

EDIT: Try this, it loops 11 times, checking if the player is in one of the 11 vehicles.


//-----------------------------------------[Commerce Trucking]--------------------//
if(strcmp(cmd, "/load", true) == 0)
{
if(PlayerInfo[playerid][pJob] == 26)
{
if(PlayerInfo[playerid][pTruckerCooldown] <= 0)
{
if(GetPVarInt(playerid, "Delivering") == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 2484.2195,-2118.1204,13.5469))
{
new InVehicle = 0;
for(new i = 0; i < 11; i++)
{
if(GetPlayerVehicleID(playerid) == ComTruck[i])
{
InVehicle = 1;
}
}
if(InVehicle == 1)
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(p layerid)))
{
if(GetPVarInt(playerid, "Loading") == 0)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, LIGHTBLUE, "Please wait while the products are loaded onto the truck...");
SetTimerEx("LoadProducts", 10000, false, "i", playerid);
SetPVarInt(playerid, "Loading", 1);
TogglePlayerControllable(playerid, 0);
return 1;
}
else return SendClientMessage(playerid, GREY, "Please wait...");
}
else return SendClientMessage(playerid, GREY, "Wait.. where's the trailer? We need something to put the products inside.");
}
else return SendClientMessage(playerid, GREY, " You can only deliver in a truck.");
}
else return SendClientMessage(playerid, GREY, " You are not at the Los Santos Product Factory.");
}
else return SendClientMessage(playerid, GREY, " You are already delivering products, either deliver it or /killcp.");
}
else return format(string, sizeof(string), "You still have %d seconds left before you can deliver more products.", PlayerInfo[playerid][pTruckerCooldown]), SendClientMessage(playerid, GREY, string);
}
else { SendClientMessage(playerid, GREY, " You are not a trucker."); }
return 1;
}

Donvalley
21/06/2013, 03:05 AM
Worked Cheers!