Function Dosen't return a value. - 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: Function Dosen't return a value. (
/showthread.php?tid=616909)
Function Dosen't return a value. -
verlaj - 12.09.2016
Код:
stock CountEventPlayersTDM(event, team)
{
new count = 0;
foreach(new i : Player)
{
if(gPlayerGamemode[i] == event)
{
if(GetPlayerTeam(i) == team) // anything ?
{
count++;
}
}
}
return count;
}
//for example this code dosen't work
CountEventPlayersTDM(MODE_TDM, TEAM_ONE);
gPlayerGamemode and SetPlayerTeam are already defined.. for players
------------------------------------------------------------------------------------------------
i am using another function which returns a value.
Код:
stock CountEventPlayers(event)
{
new count = 0;
foreach(new i : Player)
{
if(gPlayerGamemode[i] == event)//works perfectly
{
count++;//add one to the count
}
}
return count;
}
Re: Function Dosen't return a value. -
Stuntff - 12.09.2016
Код:
stock CountEventPlayersTDM(event, team)
{
new count = 0;
foreach(new i : Player) if(gPlayerGamemode[i] == event && GetPlayerTeam(i) == team) count++;
return count;
}
Possible problem "GetPlayerTeam"