05.07.2016, 04:15
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
for showing objects
CreatePlayerObject function
PHP код:
forward ObjectSpawns(playerid);
public ObjectSpawns(playerid)
{
for(new bs=0; bs<=sizeof(ObjectSpawn); bs++)
{
new ObjID;
new Float:obx, Float:oby, Float:obz, Float:obrx, Float:obry, Float:obrz, Float: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(playerid, obx, oby, obz);
if(distance[playerid] < 200.00)
{
if(ObjectCreated[OIDs][playerid] == 0)
{
ObjectCreated[OIDs][playerid] = CreatePlayerObject(playerid, ObjID, obx, oby, obz, obrx, obry, obrz, 300.0);
}
}
else
DestroyPlayerObject(playerid, ObjectCreated[OIDs][playerid]);
ObjectCreated[OIDs][playerid] = 0;
}
}
return 1;
}
PHP код:
public OnPlayerUpdate(playerid)
{
ObjectSpawns(playerid);
return 1;
}