SA-MP Forums Archive
Multiple times message? - 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: Multiple times message? (/showthread.php?tid=300673)



Multiple times message? - remyguys - 01.12.2011

When im ingame and im using this cmd /amsg, it sometimes shows up like 4 or 8 times when it should just appear only 1 time..

Is there something wrong in the lines?

Thx in Advance



PHP Code:
     if(strcmp(cmd"/amsg"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if (
PlayerInfo[playerid][pAdmin] >= 3)
            {
                new 
length strlen(cmdtext);
                while ((
idx length) && (cmdtext[idx] <= ' '))
                {
                    
idx++;
                }
                new 
offset idx;
                new 
result[64];
                while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                {
                    
result[idx offset] = cmdtext[idx];
                    
idx++;
                }
                
result[idx offset] = EOS;
                if(!
strlen(result))
                {
                    
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[USAGE:] /amsg [Message]");
                    return 
1;
                }
                
format(stringsizeof(string), "Admin %s: %s",GetPlayerNameEx(playerid),result);
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i))
                    {
                        
SendClientMessageToAll(COLOR_GREEN,string);
                    }
                }
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] Your not an administrator!");
                return 
1;
            }
        }
        return 
1;
    }