onplayerpicukup...
#1

hey. what the problem with this?
PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == hpickup[ClosestHouse(playerid)])
    {
        new 
azonosito ClosestHouse(playerid);
        new 
string[128], string1[128];
        
format(string,sizeof(string),"%s"HouseInfo[azonosito][hTulaj]);
        
PlayerTextDrawSetString(playerid,HazNev,string);
        
format(string1,sizeof(string1),"Fort Carson %i"HouseInfo[azonosito][hID]);
        
PlayerTextDrawSetString(playerid,HazSzam,string1);
        
PlayerTextDrawShow(playeridPlayerText:HazNev);
        
PlayerTextDrawShow(playeridPlayerText:HazBox);
        
PlayerTextDrawShow(playeridPlayerText:HazSzam);
        
SetTimerEx("haztextdraw"15000false"i"playerid);
    }
    return 
1;

PHP код:
stock ClosestHouse(playerid)
{
  for(new 
i=0i<MAX_HOUSESi++)
  {
    if(
IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[i][hEnterX] ,HouseInfo[i][hEnterY],HouseInfo[i][hEnterZ]))
    {
      return 
i;
    }
  }
  return -
10;

PHP код:
[21:32:20] [debugRun time error 4"Array index out of bounds"
[21:32:20] [debug]  Accessing element at negative index -10
[21:32:20] [debugAMX backtrace:
[
21:32:20] [debug#0 0005a440 in ?? (0x00000000, 0x00000001) from rrrpg.amx
[21:32:20] [debug#1 000156a8 in public Streamer_OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx
[21:32:20] [debug#2 0000fd10 in public OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx
[21:32:21] [debugRun time error 4"Array index out of bounds"
[21:32:21] [debug]  Accessing element at negative index -10
[21:32:21] [debugAMX backtrace:
[
21:32:21] [debug#0 0005a440 in ?? (0x00000000, 0x00000001) from rrrpg.amx
[21:32:21] [debug#1 000156a8 in public Streamer_OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx
[21:32:21] [debug#2 0000fd10 in public OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx
[21:32:22] [debugRun time error 4"Array index out of bounds"
[21:32:22] [debug]  Accessing element at negative index -10
[21:32:22] [debugAMX backtrace:
[
21:32:22] [debug#0 0005a440 in ?? (0x00000000, 0x00000001) from rrrpg.amx
[21:32:22] [debug#1 000156a8 in public Streamer_OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx
[21:32:22] [debug#2 0000fd10 in public OnPlayerPickUpPickup (0x00000000, 0x00000001) from rrrpg.amx 
Reply
#2

If player is not near any house, you return -10, so basically in that if you are saying:

pawn Код:
if(pickupid == hpickup[-10])
The index of an array can't be negative.

Just verify if ClosestHouse(playerid)<0 return 1;
Reply
#3

thanks
Reply
#4

and.. how to set to hide the textdraw when left the pickup? my timer is not the best option
Reply
#5

Quote:
Originally Posted by n00el
Посмотреть сообщение
thanks
Quote:
Originally Posted by n00el
Посмотреть сообщение
and.. how to set to hide the textdraw when left the pickup? my timer is not the best option
Next time, edit your post and don't double post before 24 hour or someone reply after you, or you will get an infraction and warning!
Reply
#6

Quote:
Originally Posted by n00el
Посмотреть сообщение
and.. how to set to hide the textdraw when left the pickup? my timer is not the best option
Timer with IsPlayerInRangeOfPoint is the only way to check if the player is leaving the pickup because there isn't any custom callback or parameter for it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)