11.03.2014, 23:09
I'm trying to create a fire system, and so far it's working properly. There's only one issue;
When player 1 creates a fire, he can cook on it until another players creates a fire. It's like the fire's id is being shifted around. How can i make the code detect if a player is in range of ANY fire? I have CreateObjects as the fire, as assigned a varialbe to them. Would I need to loop through them? If so, how? (The floats are global, by the way.)
If you need more code, let me know. Thank you.
EDIT: Would i need to #define MAX_FIRES ? And if so, how do i use it? I'm not very good at looping through things at all.
When player 1 creates a fire, he can cook on it until another players creates a fire. It's like the fire's id is being shifted around. How can i make the code detect if a player is in range of ANY fire? I have CreateObjects as the fire, as assigned a varialbe to them. Would I need to loop through them? If so, how? (The floats are global, by the way.)
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0,Float:fx, Float:fy, Float:fz))
{
RandomCook(playerid);
}
GetPlayerPos(playerid, Float:fx, Float:fy, Float:fz);
hasfire[playerid] = 1;
fire = CreateObject(841,Float:fx,Float:fy,Float:fz-1,0.0000000,0.0000000,0.0000000); //object(dead_tree_13) (1)
fire1 = CreateObject(3461,Float:fx,Float:fy,Float:fz-3,0.0000000,0.0000000,0.0000000); //object(tikitorch01_lvs) (1)
SetTimerEx("firetimer", 5000, false, "i", playerid);
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Loop",4,1,0,0, 0,0,1);
logs[playerid] --;
EDIT: Would i need to #define MAX_FIRES ? And if so, how do i use it? I'm not very good at looping through things at all.