[Help] How to do a /helpme command
#1

I'm a big newbie.

Could someone show me how to do a /helpme command?
Reply
#2

If using ZCMD:

command(helpme, playerid, params[])
{
#pragma unused params
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
return 1;
}
Reply
#3

If using STRCMP:


if(strcmp(cmdtext,"/helpme",true)==0)
{
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
return 1;
}
Reply
#4

How does that exactly work?

EDIT: I want it so you do /helpme then your reason so admins can see it
Reply
#5

You put it under

public OnPlayerCommandText(playerid, cmdtext[])

like this:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/helpme",true)==0)
{
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
SendClientMessage(playerid, color,"texthere...");
return 1;
}
	return 0;
}
Then go ingame and type /helpme

Note: change the 'texthere...' to the info you want to show the member.
Reply
#6

EDIT: Camacorn was faster, sorry. Delete this

Place the text that Camacorn wrote under

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp("/helpme", cmdtext, true))
  {
   SendClientMessage(playerid, YOUR_COLOR, "[COMMANDS]: Your text bla bla");
   SendClientMessage(playerid, YOUR_COLOR, "[SOMETHING]: Your text bla bla");
   }
   return 1;
}
That's the old classic way, if you use ZCMD use what Camacorn wrote you.

EDIT: Camacorn was faster, sorry. Delete this
Reply
#7

Quote:
Originally Posted by PilotXtreme
Посмотреть сообщение
How does that exactly work?

EDIT: I want it so you do /helpme then your reason so admins can see it
Please explain more next time -_-
Reply
#8

You do /helpme [reason you need help] then that gets sent to the admins like a report
Reply
#9

Untested but must work, just made in a minute.

pawn Код:
if(strcmp(cmdtext,"/helpme",true) == 0)
{
    new reason[128];
    if(sscanf(params,"s",reason)) return SendClientMessage(playerid,COLOR_RED,"* Syntax Error: /helpme [reason]");
    else
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(IsPlayerAdmin(i))
                {
                    new Playername[MAX_PLAYER_NAME],string[128];
                    GetPlayerName(playerid,Playername,sizeof(Playername));
                    format(string,sizeof(string),"%s has requested help with the following reason: %s",Playername,reason);
                    SendClientMessage(i,0x55FF00FF,string); // Green
                }
            }
        }
    }
    return 1;
}
If you need the sscanf stock, if you don't have it already, you can find it here. Just place it anywhere in your code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)