SA-MP Forums Archive
Help On CreatePlayerObject - 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: Help On CreatePlayerObject (/showthread.php?tid=611332)



Help On CreatePlayerObject - IceBilizard - 05.07.2016

Hello guys i am using CreatePlayerObject but its having some issues i don't know why its not working properly when only 1 player join the server then its showing objects to him but when another player join the server and there are 5 or 6 players in server then its not showing objects to connected player here is my code see what is the problem

CreatePlayerObject function
PHP код:
forward ObjectSpawns(playerid);
public 
ObjectSpawns(playerid)
{
    for(new 
bs=0bs<=sizeof(ObjectSpawn); bs++)
    {
        new 
ObjID;
        new 
Float:obxFloat:obyFloat:obzFloat:obrxFloat:obryFloat:obrzFloat:distance[PLAYERS];
        new 
OIDs ObjectSpawn[bs][OID];
        
ObjID ObjectSpawn[bs][ObjectID];
        
obx ObjectSpawn[bs][objx];
        
oby ObjectSpawn[bs][objy];
        
obz ObjectSpawn[bs][objz];
        
obrx ObjectSpawn[bs][objrx];
        
obry ObjectSpawn[bs][objry];
        
obrz ObjectSpawn[bs][objrz];
        
distance[playerid] = GetPlayerDistanceFromPoint(playeridobxobyobz);
        if(
distance[playerid] < 200.00)
        {
                 if(
ObjectCreated[OIDs][playerid] == 0)
                 {
                      
ObjectCreated[OIDs][playerid] = CreatePlayerObject(playeridObjIDobxobyobzobrxobryobrz300.0);
                 }
        }
        else
                
DestroyPlayerObject(playeridObjectCreated[OIDs][playerid]);
                
ObjectCreated[OIDs][playerid] = 0;
        }
    }
    return 
1;

for showing objects
PHP код:
public OnPlayerUpdate(playerid)
{
  
ObjectSpawns(playerid);
  return 
1;