/addcocoseiall problem
#1

I have a proboem:
I have a command wich should give to ALL players online the ammount of gold typed in command.
Command:
pawn Код:
if(strcmp(cmd, "/addcocoseiall", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "UTILIZEAZA: /addcocoseiall [suma]");
                return 1;
            }
            new money;
            money = strval(tmp);
            for(new i = 0; i < MAX_PLAYERS; i ++)
            if (PlayerInfo[playerid][pAdmin] >= 1338)
            {
                if(IsPlayerConnected(playerid))
                {
                    if(i != INVALID_PLAYER_ID)
                    {
                        PlayerInfo[i][pCocosi] += money;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, 256, "ATENTIE ADMINI: %s a dat tututor jucatorilor Online %d Cocosei.", sendername,giveplayer,money);
                        ABroadCast(COLOR_YELLOW,string,1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti autorizat pentru folosirea comenzii!");
            }
        }
        return 1;
    }
Help
Reply
#2

And what is not working?
Try to change this
pawn Код:
if(IsPlayerConnected(playerid))
With
pawn Код:
if(IsPlayerConnected(i))
Reply
#3

Do what Tazs says and also

EDIT:

i read that wrong....

answer above.
Reply
#4

When i type/addcocoseiall, it appears a number of SendClientMessage in the chat = with the number ob online playerss.
Also, if i type any number,the result will be 0,like:
/addcocoseiall 1
It giving 0 gold instead of 1
Reply
#5

Try removing this line

pawn Код:
tmp = strtok(cmdtext, idx);
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Try removing this line

pawn Код:
tmp = strtok(cmdtext, idx);
I can't, it will have more errors,
Look at the command:
pawn Код:
if(strcmp(cmd, "/addcocoseiall", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "UTILIZEAZA: /addcocoseiall [suma]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 1338)
            {
                new money;
                money = strval(tmp);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, 256, "ATENTIE ADMINI: %s a dat tututor jucatorilor Online %d Cocosei.", sendername,money);
                ABroadCast(COLOR_YELLOW,string,1);
                for(new i = 0; i < MAX_PLAYERS; i ++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(i != INVALID_PLAYER_ID)
                        {
                            PlayerInfo[i][pCocosi] += money;
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti autorizat pentru folosirea comenzii!");
            }
        }
        return 1;
    }
Reply
#7

Quote:
Originally Posted by calin1996
Посмотреть сообщение
I can't, it will have more errors
Did you try it?
Reply
#8

Look,i did what he said,and is the same thing!
pawn Код:
if(strcmp(cmd, "/addcocoseiall", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "UTILIZEAZA: /addcocoseiall [suma]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 1338)
            {
                new money;
                money = strval(tmp);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                for(new i = 0; i < MAX_PLAYERS; i ++)
                {
                    if(IsPlayerConnected(i))
                    {
                        PlayerInfo[i][pCocosi] += money;
                        format(string, sizeof(string), "AdmCmd: %s a dat cate %d cocosei la fiecare player Online.",sendername,money);
                        SendClientMessage(i,COLOR_RED,string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti autorizat pentru folosirea comenzii!");
            }
        }
        return 1;
    }
And image:


Uploaded with ImageShack.us
Reply
#9

I don't see the text in the picture in the command code. Where is it?
Reply
#10

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
I don't see the text in the picture in the command code. Where is it?
This man is right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)