Hello There, Guest! Login or Register


Useful Functions/Snippets/Commands
#4
Meh, wanna keep this section alive, dunno what to post :S

KickAllExceptAdmins()
An example on how to use looping:

Code:
stock KickAllExceptAdmins()
{
    for(new i = 0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i)
        {
           if(!IsPlayerAdmin(i))
           {
                Kick(i);
           }
        }
    }
}

Simple Join Messages

Again, I guess it can be used as an example.

Code:
public OnPlayerConnect(playerid)
{
    new gConnectname[255],str[256];
    GetPlayerName(playerid, gConnectname, 255);
    format(str,256,"*** %s (ID:%d) has joined the server.",gConnectname,playerid);
    SendClientMessageToAll(0xAFAFAFAA,str);
    return true;
}

public OnPlayerDisconnect(playerid,reason)
{
   new str[256],gConnectname[255];
   GetPlayerName(playerid,gConnectname,255);
   switch(reason)
   {
        case 0: format(str,256,"%s has Timed Out!",gConnectname);
        case 1: format(str,256,"%s has left the server.",gConnectname);
        case 2: format(str,256,"%s has been kicked out the server.",gConnectname);

   }
   SendClientMessageToAll(0xAFAFAFAA,str);
   return true;
}

Dunno what else :S
Reply


Messages In This Thread
Useful Functions/Snippets/Commands - by Jay - 04-21-2008, 03:19 PM
Re: Useful Functions/Snippets/Commands - by Jay - 04-21-2008, 07:42 PM
Re: Useful Functions/Snippets/Commands - by Smoke - 04-23-2008, 06:50 AM
Re: Useful Functions/Snippets/Commands - by Jay - 04-23-2008, 04:54 PM
Re: Useful Functions/Snippets/Commands - by Smoke - 04-24-2008, 10:18 AM
Re: Useful Functions/Snippets/Commands - by Jay - 04-29-2008, 01:03 PM
Re: Useful Functions/Snippets/Commands - by Jay - 05-08-2008, 11:54 AM
Re: Useful Functions/Snippets/Commands - by Jay - 02-02-2009, 10:17 PM