15.10.2011, 20:28
hi guys i have got a question..How can i;Example Give to everyone money or heal everyone in the server whats the code to give somethink to everyone in the server??
for ( new i = 0; i < MAX_PLAYERS; i ++ )
{
GivePlayerMoney( i, 1000 ) ; // Give all players $1000
}
for(new i = 0; i < MAX_PLAYERS; i++) { GivePlayerMoney(i, val); }
Loop
pawn Код:
|
for(new i, PP = GetMaxPlayers(); i < PP; i++)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerMoney(i, 1000);
}
//Or
#define GiveAllMoney(%0) for(new i,PP=GetMaxPlayers;i<PP;i++), GivePlayerMoney(i,%0)
#include <foreach>
foreach(Player, i) {
SetPlayerHealth(i, 100);
}
if (strcmp("/Healall", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid)) { for(new i, PP = GetMaxPlayers(); i < PP; i++) { if(!IsPlayerConnected(i)) continue; GivePlayerMoney(i, 1000); GameTextForPlayer(playerid,"~g~1000 money for all!",5000,4); } }else SendClientMessage(playerid,by,"Sorry Only admins can give money to everyone");