SA-MP Forums Archive
Loop or IsPlayerInRageOfPoint - 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: Loop or IsPlayerInRageOfPoint (/showthread.php?tid=558806)



Loop or IsPlayerInRageOfPoint - Sime30 - 19.01.2015

Hi guys!

I can't fix an issue.
IsPlayerInRageOfPoint is not working when I am trying to buy a biz, but IT IS WORKING when I try to Enter an owned biz

NO ERRORS OR WARNINGS IN MYSQLOG!

pawn Код:
CMD:buybiz(playerid, params[])
{
      for (new i = 0; i < MAX_BIZ; ++i)
        {
            if(IsPlayerInRangeOfPoint(playerid,3.0,BizInfo[i][EXTX],BizInfo[i][EXTY],BizInfo[i][EXTZ]))
            { // I put else and it says I am not near
When entering , it works like a charm

pawn Код:
if(Keys &  KEY_SECONDARY_ATTACK)
        {
            for (new i = 0; i < MAX_BIZ; ++i)
            {
                if(IsPlayerInRangeOfPoint(playerid,3.0,BizInfo[i][EXTX],BizInfo[i][EXTY],BizInfo[i][EXTZ]))
                {
Creating the biz . NOTE: Everything works with inserting in database. I translated these names to English.

pawn Код:
new ID = SpawnedBizess;
mysql_format(MySQLHandle, Query, sizeof(Query),"INSERT INTO  bizess ( OwnerName , Type , etc, etc , Price , EXTX , EXTY , EXTZ , Owned ) VALUES ('No-one',%d,50,0,%d,%f,%f,%f,0)",type,price,xa,ya,za);
                    mysql_tquery(MySQLHandle, Query, "OnBizCreate", "i", ID);
pawn Код:
forward OnBizCreate(bizid);
public OnBizCreate(bizid)
{
   
    BizInfo[idfirme][BizID] = cache_insert_id();
    SpawnedBizess++;
    printf("New Biz - ID: %d", BizInfo[idfirme][BizID]);
}
When loading...
pawn Код:
OnGameModeinit
{
    mysql_tquery(MySQLHandle, "SELECT * FROM bizess", "LoadBiz", "");
}

forward LoadBiz();
public LoadBiz()
{
        new Query[ 256 ];

        if(cache_num_rows())
        {
            for(new i, j = cache_num_rows(); i < j ; i++)
            {
BizInfo[i][BizID] = cache_get_field_content_int(i, "BizID");

                        cache_get_field_content(i,"OwnerName",BizInfo[i][OwnerName],MySQLHandle,25);

                        BizInfo[i][Type] = cache_get_field_content_int(i, "BizInfo");
// ...
// ...
SpawnedBizess++;
            }
        }
        return 1;
}



Re: Loop or IsPlayerInRageOfPoint - Sime30 - 19.01.2015

Fixed, some silly returns :S