MainRegistrationLogin 乂Ŧ®ξMĮ૬Ŧ૬ Saturday, 2024-11-30, 11:25 AM
  Usefull snippets - Forum Welcome Forum Nub | RSS | Login | My Profile


My personal messages () · New forum posts · Forum members · Forum rules · Search · RSS · Logout
  • Page 1 of 1
  • 1
Forum moderator: Jordan, eXtreme72  
Usefull snippets
eXtreme72Date: Wednesday, 2008-12-03, 4:29 PM | Message # 1
Lieutenant colonel
Group: Administrators
Messages: 103
Reputation: 0
Status: Offline
Post any usefull snippets here. Let me start:

Connect message
Sends an icon on the right side that the player has joined the server.

Code
public OnPlayerConnect(playerid)
{
      SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
      return 1;
}

Disconnect message
Sends an icon on the right side that the player has left the server.

Code
public OnPlayerDisconnect(playerid)
{
      SendDeathMessage(playerid, INVALID_PLAYER_ID, 201);
      return 1;
}

Hackers ban
Bans a player if they try to crash the server.

Code
Words(string[])
{
  new idx,words;
  while(strlen(strtok(string,idx))) words++;
  return words;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
  for(new i=0, j=Words(cmdtext), idx; i<j; i++)
{
   new tmpstr[256];
   tmpstr = strtok(cmdtext, idx);
   if(isNumeric(tmpstr) && strlen(tmpstr) > 49)
{
    Ban(playerid);
    return 1;
   }
  }
}

Forum mess up the identation, sorry.

// Copied from my forum.





 
  • Page 1 of 1
  • 1
Search:

 

Copyright MyCorp © 2024
Hosted by uCoz