Can someone help me?
#1

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 ?
Reply
#2

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;
        }
    }
}
Reply
#3

Same problem :S
Reply
#4

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

On stock funcion,

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

bump, help anyone?
Reply
#7

another bump
Reply
#8

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

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

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;
}
Reply
#10

bump srry
Reply
#11

Another bump :-/
Reply
#12

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..
Reply
#13

i really dont know i just asking for help
Reply
#14

gladly, but I do not know how to do that
Reply
#15

You can't use PVars to save businesses data.

PVars are for players only.

https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#16

i need to put data in enumator?
Reply
#17

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


Forum Jump:


Users browsing this thread: 1 Guest(s)