MainRegistrationLogin 乂Ŧ®ξMĮ૬Ŧ૬ Thursday, 2024-05-16, 6:08 PM
  Usefull commands - 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  
Forum » San Andreas Multiplayer » SA:MP Scripting » Usefull commands
Usefull commands
eXtreme72Date: Wednesday, 2008-12-03, 4:27 PM | Message # 1
Lieutenant colonel
Group: Administrators
Messages: 103
Reputation: 0
Status: Offline
Usefull commands go here. Post and feel free.

Strtok
Usefull for OnPlayerCommand text.
Put it on end of your script, just make sure it's not in a function!

Code
strtok(const string[], &index)
{
     new length = strlen(string);
     while ((index < length) && (string[index] <= ' '))
     {
      index++;
     }

     new offset = index;
     new result[20];
     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
     {
      result[index - offset] = string[index];
      index++;
     }
     result[index - offset] = EOS;
     return result;
}

Clear
Clears the chat.

Code
if(strcmp(cmdtext, "/clearchat", true) == 0)
{
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           SendClientMessage(playerid, COLOR_YELLOW, " ");
           return 1;
}

Announce
Sends a GameText for everybody. Good for admins to announce something.

Code
if(strcmp(cmd, "/announce", true) == 0)
{
         new name[256];
          new tmp[256];
          new tstring[256];
          tmp = strtokspace(cmdtext, idx);
          GetPlayerName(playerid,name,sizeof(name));
          format(tstring, sizeof(tstring), "* %s: %s", name, tmp);
          GameTextForAll(tmp, 5000, 3);
          return 1;
}

Night
Changes the time to night time. Go on, wank a lil'

Code
if(strcmp(cmd, "/night", true) == 0)
{
          SetWorldTime(0);
          return 1;
}

Jordan
Jordan...

Code
if(strcmp(cmd, "/jordan", true) == 0)
{
          SendClientMessage(playerid, COLOR_YELLOW, "Huh?");
          return 1;
}

Nothing hard.
P.S. Sorry for identation, the forum messes it all!

// Copied from my forum.





 
Vikt0rDate: Wednesday, 2008-12-03, 5:04 PM | Message # 2
Lieutenant
Group: Administrators
Messages: 66
Reputation: 3
Status: Offline
Code

if (strcmp("/kill", cmdtext, true, 10) == 0)
{
     SetPlayerHealth(playerid,0.0)
     return 1;
}

just a simple /kill command lol.

btw,can anyone send me AAD mode?


.
 
eXtreme72Date: Wednesday, 2008-12-03, 5:12 PM | Message # 3
Lieutenant colonel
Group: Administrators
Messages: 103
Reputation: 0
Status: Offline
I'll send you on MSN.




 
JordanDate: Wednesday, 2008-12-03, 5:49 PM | Message # 4
Major
Group: Moderators
Messages: 81
Reputation: 1
Status: Offline
Quote (eXtreme72)
Jordan
Jordan...
Code

if(strcmp(cmd, "/jordan", true) == 0)   
{   
            SendClientMessage(playerid, COLOR_YELLOW, "Huh?");   
            return 1;   
}

Huh?
Rules
Code
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/rules", cmdtext, true, 10) == 0)
  {
   SendClientMessage(playerid, RED, "Do not flame people");
   SendClientMessage(playerid, RED, "Do not ruin people's video");
   SendClientMessage(playerid, RED, "No Racism, porn, flaming, etc allowed");
   SendClientMessage(playerid, RED, "Respect people");
   SendClientMessage(playerid, blue, "End of /rules");
   SendClientMessage(playerid, green, "Website: www.XsClan.ucoz.com");
   SendClientMessage(playerid, yellow, "IRC Echo: #jordan");
   SendClientMessage(playerid, orange, "Enjoy your visit!");
   return 1;
  }
  return 0;
}

//You can edit the stuff wich is in the SendClientMessage wink


 
BALLIN026Date: Thursday, 2009-01-08, 4:38 PM | Message # 5
Group: Removed





You forgot giving us the defined colors :/
 
eXtreme72Date: Thursday, 2009-01-08, 5:19 PM | Message # 6
Lieutenant colonel
Group: Administrators
Messages: 103
Reputation: 0
Status: Offline
Yea, Jordan, you biach!




 
JordanDate: Thursday, 2009-01-08, 5:35 PM | Message # 7
Major
Group: Moderators
Messages: 81
Reputation: 1
Status: Offline
Stfu nobatos tongue

Find out yo' self


 
eXtreme72Date: Thursday, 2009-01-08, 7:22 PM | Message # 8
Lieutenant colonel
Group: Administrators
Messages: 103
Reputation: 0
Status: Offline
You're still a biach.




 
Forum » San Andreas Multiplayer » SA:MP Scripting » Usefull commands
  • Page 1 of 1
  • 1
Search:

 

Copyright MyCorp © 2024
Hosted by uCoz