SA-MP Forums Archive
Can someone help me? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can someone help me? (/showthread.php?tid=188500)



Can someone help me? - [H]265 - 07.11.2010

This code wonґt work correctly

pawn Код:
if(IsPlayerNearBiz(playerid) == -1) return SendClientMessage(playerid,siva,"ERROR: You are not near biz");
pawn Код:
stock IsPlayerNearBiz(playerid)
{
  for(new C; C<IDBiz+1; C++)
  {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(C,"PickupX"),GetPVarFloat(C,"PickupY"), GetPVarFloat(C,"PickupZ"))) return C;
  }
  return -1;
}
When i standing on pickup and type command: /buybiz it say "You are not near biz" can someone help ?


Re: Can someone help me? - The_Moddler - 07.11.2010

pawn Код:
stock IsPlayerNearBiz(playerid)
{
    for(new C; C < IDBiz+1; C++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(C,"PickupX"),GetPVarFloat(C,"PickupY"), GetPVarFloat(C,"PickupZ")))
        {
            return C;
        }
        else
        {
            return -1;
        }
    }
}



Re: Can someone help me? - [H]265 - 07.11.2010

Same problem :S


Re: Can someone help me? - Scott - 07.11.2010

Where are you defining the PVar's PickupX/Y/Z?


Re: Can someone help me? - [H]265 - 08.11.2010

On stock funcion,

pawn Код:
stock CreateBiz(Float:X,Float:Y,Float:Z....)
{
        new
        ID ++;
        SetPVarFloat(ID,"PickupX",Float:X);
        etc etc....
        return ID;
}
}


Re: Can someone help me? - [H]265 - 08.11.2010

bump, help anyone?


Re: Can someone help me? - [H]265 - 09.11.2010

another bump


Re: Can someone help me? - lameguy - 09.11.2010

if(isplayerinrangeofpoint...) return true;
else return false;

and use if(!IsPlayerNearBiz(playerid)) then.
Should work


Re: Can someone help me? - (SF)Noobanatior - 10.11.2010

no it wont coz false = 0 and 0 is a biz id

how about this
pawn Код:
stock IsPlayerNearBiz(playerid){
    new test =-1;
    for(new C; C <= IDBiz; C++)    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(C,"PickupX"),GetPVarFloat(C,"PickupY"), GetPVarFloat(C,"PickupZ")))        {
            test = C;
            break;
        }
    }
    return test;
}



Re: Can someone help me? - [H]265 - 17.11.2010

bump srry


Re: Can someone help me? - [H]265 - 18.11.2010

Another bump :-/


Re: Can someone help me? - wups - 18.11.2010

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
pawn Код:
stock IsPlayerNearBiz(playerid)
{
    for(new C; C < IDBiz+1; C++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(C,"PickupX"),GetPVarFloat(C,"PickupY"), GetPVarFloat(C,"PickupZ")))
        {
            return C;
        }
        else
        {
            return -1;
        }
    }
}
Also this code is stupid.
If a player is not near a biz ID 1, the loop ends..


Re: Can someone help me? - [H]265 - 18.11.2010

i really dont know i just asking for help


Re: Can someone help me? - [H]265 - 18.11.2010

gladly, but I do not know how to do that


Re: Can someone help me? - MadeMan - 18.11.2010

You can't use PVars to save businesses data.

PVars are for players only.

https://sampwiki.blast.hk/wiki/Per-player_variable_system


Re: Can someone help me? - [H]265 - 18.11.2010

i need to put data in enumator?


Re: Can someone help me? - MadeMan - 18.11.2010

Quote:
Originally Posted by [H]265
Посмотреть сообщение
i need to put data in enumator?
Yes, use enum.