playerid problem
#1

Hi, i use some random fire script and of course the player will burn when he is on fire. The problem is that it won't work for playerid - 1, it works perfect for playerid - 0. If the playerid - 1 stands on fire it won't work until the playerid - 0 is not standing on it too! So as you maybe understand while the playerid - 1 stands alone it won't work!

pawn Code:
public OnFireUpdate()
{
    foreach (Player, playerid)
    {
        if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) { continue; }
        if(PlayerOnFire[playerid] && !CanPlayerBurn(playerid, 1))
        { StopPlayerBurning(playerid); }
        if(Pissing_at_Flame(playerid) != -1 || Aiming_at_Flame(playerid) != -1)
        {

            GameTextForPlayer(playerid, " ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~~h~You are close to a fire place!", 1500, 6);
            if(!ExtTimer[playerid] && ((Aiming_at_Flame(playerid) != -1 && Pressing(playerid) & KEY_FIRE) || Pissing_at_Flame(playerid) != -1))
            {
                new value, time, Float:x, Float:y, Float:z;
                if(Pissing_at_Flame(playerid) != -1)
                {
                    value = Pissing_at_Flame(playerid);
                    time = EXTINGUISH_TIME_PEEING;
                }
                else if(Aiming_at_Flame(playerid) != -1)
                {
                    value = Aiming_at_Flame(playerid);
                    if(IsPlayerInAnyVehicle(playerid))
                    {
                        time = EXTINGUISH_TIME_VEHICLE;
                    }
                    else
                    {
                        time = EXTINGUISH_TIME_ONFOOT;
                    }
                }
                if(value < -1) { time = EXTINGUISH_TIME_PLAYER; }
                time *= 1000;
                if(value >= -1)
                {
                    x = Flame[value][Flame_x];
                    y = Flame[value][Flame_y];
                    z = Flame[value][Flame_z];
                    DestroySmoke(value);
                    Flame[value][Smoke][0] = CreateObject(18727, x, y, z, 0.0, 0.0, 0.0);
                    Flame[value][Smoke][1] = CreateObject(18727, x+1, y, z, 0.0, 0.0, 0.0);
                    Flame[value][Smoke][2] = CreateObject(18727, x-1, y, z, 0.0, 0.0, 0.0);
                    Flame[value][Smoke][3] = CreateObject(18727, x, y+1, z, 0.0, 0.0, 0.0);
                    Flame[value][Smoke][4] = CreateObject(18727, x, y-1, z, 0.0, 0.0, 0.0);
                    SetTimerEx("DestroySmoke", time, 0, "d", value);
                }
                ExtTimer[playerid] = SetTimerEx("FireTimer", time, 0, "dd", playerid, value);
            }
        }
        if(CanPlayerBurn(playerid) && IsAtFlame(playerid)) { SetPlayerBurn(playerid); }
        new Float:x, Float:y, Float:z;
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(playerid != i && !IsPlayerNPC(i) && CanPlayerBurn(i) && PlayerOnFire[playerid] && !PlayerOnFire[i])
            {
                GetPlayerPos(i, x, y, z);
                if(IsPlayerInRangeOfPoint(playerid, 1, x, y, z))
                {
                    SetPlayerBurn(i);
                }
            }
        }
    }
    return 1;
}
Reply
#2

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)