Having more IsPlayerInRangeOfPoint
#1

I currently have this code:

PHP код:
hook OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_WALK))
    {
        if(
IsPlayerInAnyVehicle(playerid)) return 0;
        new 
_mercID IsPlayerNearMercenary(playerid);
        if(
_mercID == -1) return 0;
        
        
ShowPlayerMercenaryInv(playerid_mercID);
    }
    
    return 
1;

But I wanted to remove "IsPlayerNearMercenary(playerid)" since I can't deal with it. It would be good if IsPlayerNearMercenary(playerid) can have many IsPlayerInRangeOfPoint, it's this:

PHP код:
IsPlayerNearMercenary(playerid)
{
    for(new 
i<MAX_MERCENARIESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.5MercenaryInfo[i][mercPosX], MercenaryInfo[i][mercPosY], MercenaryInfo[i][mercPosZ]))
            return 
i;
    }
    return -
1;

I've tried it changing to this but it doesn't work:

PHP код:
IsPlayerNearMercenary(playerid)
{
    for(new 
i<MAX_MERCENARIESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.5, -2817.39331, -1516.39526140.74620))
        if(
IsPlayerInRangeOfPoint(playerid1.5, -2386.691412216.228525.07300))
        if(
IsPlayerInRangeOfPoint(playerid1.5499.88400, -223.2224013.35980))
        if(
IsPlayerInRangeOfPoint(playerid1.5, -417.85309, -1754.719976.46650))
        if(
IsPlayerInRangeOfPoint(playerid1.5, -663.983702316.17261138.87550))
            return 
i;
    }
    return -
1;

Now to get back, that OnPlayerKeyStateChange, I want to change the part of "IsPlayerNearMercenary" to those different IsPlayerInRangeOfPoint, unless I know how to make IsPlayerNearMercenary work with different IsPlayerInRangeOfPoint. Thanks, I'll totally +rep who ever helps me how to do it.
Reply


Messages In This Thread
Having more IsPlayerInRangeOfPoint - by DarkMythHunter - 14.01.2019, 00:55
Re: Having more IsPlayerInRangeOfPoint - by DarkMythHunter - 14.01.2019, 05:02
Re: Having more IsPlayerInRangeOfPoint - by d3Pedro - 14.01.2019, 05:40
Re: Having more IsPlayerInRangeOfPoint - by DarkMythHunter - 15.01.2019, 04:04

Forum Jump:


Users browsing this thread: 1 Guest(s)