give all weapon (help asap +rep) - 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: give all weapon (help asap +rep) (
/showthread.php?tid=485495)
give all weapon (help asap +rep) -
ReD_HunTeR - 04.01.2014
Код:
CMD:giveallweapon(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
for(new i = 0; i < MAX_PLAYERS; i++)
{
new weapon, ammo, string[128], name[128];
if(sscanf(params,"ii", weapon, ammo)) return SendClientMessage(playerid, grey,"Syntax: /giveallweapon [weaponid] [ammo]");
if(IsPlayerConnected(i)) { GivePlayerWeapon(i, weapon, ammo); }
format(string,sizeof(string),"Administrator %s has given all players weapon: %d with %d ammo",name,weapon,ammo);
SendClientMessageToAll(blue,string);
CMDMessageToAdmins(playerid,"GIVEALLWEAPON");
}
else SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
return 1;
}
i want to show that "Administrator %s has given all players weapon: %d with %d ammo" one time, but its showing how much number of player is playing, that much time..
Re: give all weapon (help asap +rep) -
ReD_HunTeR - 04.01.2014
comon help?
Re: give all weapon (help asap +rep) - Patrick - 04.01.2014
You forgot to use
GetPlayerName, to store the player's name inside the
name array/variable.
pawn Код:
CMD:giveallweapon(playerid, params[])
{
new
weapon,
ammo,
string[ 128 ],
name[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(PlayerInfo[playerid][Level] <= 5 || !IsPlayerAdmin(playerid))
return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
if(sscanf(params,"ii", weapon, ammo))
return SendClientMessage(playerid, grey,"Syntax: /giveallweapon [weaponid] [ammo]");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerWeapon(i, weapon, ammo);
}
format(string,sizeof(string),"Administrator %s has given all players weapon: %d with %d ammo", name, weapon, ammo);
SendClientMessageToAll(blue, string);
return CMDMessageToAdmins(playerid,"GIVEALLWEAPON");
}