[Help] Double Message in ADMIN CMD
#1

Help Double Message When Give all Player Weapon.....


This My Script
pawn Код:
CMD:giveallweapon(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new weapid, ammo;
if(sscanf(params,"dd", weapid, ammo)) return SendClientMessage(playerid, RED,"[USAGE]: /giveallweapon [weapon] [ammo]");
if(IsValidWeapon(weapid))
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GivePlayerWeapon(i, weapid, ammo);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
new str[150];
format(str, sizeof(str),"Administrator %s has given everyone %d ammo of weapon id : %d", pName, ammo, weapid);
SendClientMessageToAll(COLOR_ORANGE, str);
}
else return SendClientMessage(playerid, COLOR_ORANGE,"You are not allowed to give this weapon!");
}
else return SendClientMessage(playerid, RED,"You Are Not Administrator");
}
return 1;
}
Reply
#2

Try this
pawn Код:
CMD:giveallweapon(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2)
        return SendClientMessage(playerid, RED,"You Are Not Administrator");

    new weapid, ammo;
    if(sscanf(params,"dd", weapid, ammo))
        return SendClientMessage(playerid, RED,"[USAGE]: /giveallweapon [weapon] [ammo]");

    if(!IsValidWeapon(weapid))
        return SendClientMessage(playerid, COLOR_ORANGE,"You are not allowed to give this weapon!");

    new str[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(str, sizeof(str),"Administrator %s has given everyone %d ammo of weapon id : %d", pName, ammo, weapid);
    SendClientMessageToAll(COLOR_ORANGE, str);

    for(new i; i < MAX_PLAYERS; i ++)
        if(IsPlayerConnected(i))
            GivePlayerWeapon(i, weapid, ammo);

    return 1;
}
Reply
#3

Thanks Working..

Whats wrong in my script

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
Try this
pawn Код:
CMD:giveallweapon(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2)
        return SendClientMessage(playerid, RED,"You Are Not Administrator");

    new weapid, ammo;
    if(sscanf(params,"dd", weapid, ammo))
        return SendClientMessage(playerid, RED,"[USAGE]: /giveallweapon [weapon] [ammo]");

    if(!IsValidWeapon(weapid))
        return SendClientMessage(playerid, COLOR_ORANGE,"You are not allowed to give this weapon!");

    new str[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(str, sizeof(str),"Administrator %s has given everyone %d ammo of weapon id : %d", pName, ammo, weapid);
    SendClientMessageToAll(COLOR_ORANGE, str);

    for(new i; i < MAX_PLAYERS; i ++)
        if(IsPlayerConnected(i))
            GivePlayerWeapon(i, weapid, ammo);

    return 1;
}
sorry for my bad english
Reply
#4

SendClientMessageToAll send 1 message to all online players, and you were using this with loop : for(new...
Reply
#5

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
SendClientMessageToAll send 1 message to all online players, and you were using this with loop : for(new...
OMG Guys Thank's Alot..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)