Problem with a "UAV" function
#1

Hey guys,

This is my first post here, sorry if I'm doing something wrong!

I have a problem with a system that I call UAV. I'm making a deathmatch server to get better in PAWNO.
I want to have a killstreak system where you get a uav when you have 10 kills.
On to 10th kill you will get all the playersmarkers on the map. The weird thing is that is looks like it's working.
I used Printf to check it and it's reading both UAV==1 and UAV == 0. Plz help me

My code (only the stuff that you need for this function):

PHP код:
public OnPlayerSpawn(playerid)
UAV();
public 
OnPlayerDeath(playerid, killerid, reason)
if(
GetPlayerScore(killerid) == 10)
{
     
SetPVarInt(killerid, "UAV", 1);
     
SendClientMessage(killerid, COLOUR_ORANGE, "KILLSTREAK # 10: Your UAV is online.");
     
format(string, sizeof(string), "%s has a Killstreak of ten! Watch out, %s can see you now!", name, name);
     
SendClientMessageToAll(COLOUR_ORANGE, string);
}
UAV();
public 
UAV()
{
    for(new 
playerid; playerid < MAX_PLAYERS; playerid++)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
GetPVarInt(playerid, "UAV")== 1)
            {
                for (new 
showplayerid; showplayerid < MAX_PLAYERS; showplayerid++)
                {
                    if(
playerid == showplayerid) break;
                    {
                        if(
IsPlayerConnected(showplayerid))
                        {
                            
SetPlayerMarkerForPlayer(playerid, showplayerid, COLOUR_RED);
                            
printf("UAV: show player %d for player %d", showplayerid, playerid);
                        }
                    }
                }
                
            }
            else
            {
                for (new 
showplayerid; showplayerid < MAX_PLAYERS; showplayerid++)
                {
                    if(
playerid == showplayerid) break;
                    {
                        if(
IsPlayerConnected(showplayerid))
                        {
                            
SetPlayerMarkerForPlayer(playerid, showplayerid, COLOUR_INV);
                            
printf("UAV: hide player %d for player %d", showplayerid, playerid);
                        }
                    }
                }
            }
        }
    }
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)