Problem with a "UAV" function - 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: Problem with a "UAV" function (
/showthread.php?tid=354406)
Problem with a "UAV" function -
Kasszz - 26.06.2012
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;
}