Help with for foreach - 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: Help with for foreach (
/showthread.php?tid=440789)
Help with for foreach -
superaconi - 31.05.2013
I have 1 error when i want to compile my gamemod i want to put music on server for all players here is lines:
C:\Icons\Samp Fajlovi\Ultra Gaming RP v.1.8\gamemodes\UGRPG.pwn(32022) : error 017: undefined symbol "i"
Line 32022:
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/q6s8genu5u/harlem_shake_-_full_song.mp3");
PHP код:
if (strcmp("/harlemshake", cmdtext, true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/q6s8genu5u/harlem_shake_-_full_song.mp3");
}
else
{
SendClientMessage(playerid, COLOR_ASKQ, "Niste ovlasceni da koristite ovu komandu");
return 1;
}
}
What i must to do to fix this?
Re: Help with for foreach -
IceBilizard - 31.05.2013
pawn Код:
if (strcmp("/harlemshake", cmdtext, true) == 0)
{
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/q6s8genu5u/harlem_shake_-_full_song.mp3");
}
else
{
SendClientMessage(playerid, COLOR_ASKQ, "Niste ovlasceni da koristite ovu komandu");
return 1;
}
}
}
or
pawn Код:
if (strcmp("/harlemshake", cmdtext, true) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/q6s8genu5u/harlem_shake_-_full_song.mp3");
}
else
{
SendClientMessage(playerid, COLOR_ASKQ, "Niste ovlasceni da koristite ovu komandu");
return 1;
}
}
}
Re: Help with for foreach -
superaconi - 31.05.2013
Thank you