SA-MP Forums Archive
Bug with isplayerinrangeofpoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bug with isplayerinrangeofpoint (/showthread.php?tid=414479)



Bug with isplayerinrangeofpoint - icko202 - 09.02.2013

Ok, so this is the script

if(!strcmp(cmdtext, "/loadtruck"))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a truck from the depot.");
IsPlayerInRangeOfPoint(playerid, 1, 2428.7221679688, -2102.3930664063, 13.552991867065);
{
ShowPlayerDialog(playerid,13,DIALOG_STYLE_LIST,"Wh at do you want to load?","Clothes - 7.000$ \nWeapons - 9mm + 5.000$ \nEquipment - Armor + 5.500$ \nGas - 15.000$ \nPizza - 7.000$","Load","Cancel");
}
return 1;
}
return 0;
}

When i type /loadtruck when im out of the loadtruck location it shows me the dialog again, but i want to say "You are not at the loadplace."


Re: Bug with isplayerinrangeofpoint - DiGiTaL_AnGeL - 09.02.2013

Modify your IsPlayerInRangeOfPoint with this:
pawn Код:
IsPlayerInRangeOfPoint(playerid, 5.0, 2428.7221679688, -2102.3930664063, 13.552991867065);



Re: Bug with isplayerinrangeofpoint - MP2 - 09.02.2013

Do you really need coordinates THAT specific?

pawn Код:
if(!strcmp(cmdtext, "/loadtruck"))
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a truck from the depot.");
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 2428.72, -2102.39, 13.5))
    {
        return SendClientMessage(playerid, color, "You are not at the loading place.");
    }
    ShowPlayerDialog(playerid,13,DIALOG_STYLE_LIST,"Wh at do you want to load?","Clothes - 7.000$ \nWeapons - 9mm + 5.000$ \nEquipment - Armor + 5.500$ \nGas - 15.000$ \nPizza - 7.000$","Load","Cancel");
    return 1;
}
Also

if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)

doesn't check if they're in a/the truck; it just checks if they're a driver.


Re: Bug with isplayerinrangeofpoint - icko202 - 09.02.2013

then how to make it to check if the player is in truck?