/help command for player
#1

Anyone know about /help command for normal player?

So basically this will send a help to an online administrator with a [HELP] Tag. Let's say something...

Player Id 5 use /help command...
/help hi admins how do I slice bread?

Send messagetoonlineadmins even there are no admins online like this below,
"[HELP] Playername [ID:5]: hi admins how do I slice bread?
Reply
#2

This is onley if you are using sscanaf and zcmd...

PHP код:
CMD:help(playerid ,params[])
{
    new 
msg[128] ,pname[MAX_PLAYER_NAME];
   
GetPlayerName(playeridpnamesizeof(pname));
    if (!
sscanf(params ,"s[128]" ,msg )
    {
        if(
IsPlayerConnected(playerid))
        {
            
format(msg ,sizeof(msg) ,"[HELP] %s [ID:%i]: %s" ,pname ,playerid ,msg);
            
SendClinetMessage(playerid ,COLOR ,"You have sent your message to the admins!");
            
// HERE you can throw in your custom admin check func. or you can just stick with this
            
for(new 0MAX_PLAYERS i++)
            {
                
// change your variable name if its diffrent
                 
if(playerInfo[i][admin] >= 1)
                 {
                      
SendClientMessage(,COLOR ,msg);
                 }
            }
        }
        else return 
SCM(playerid ,COLOR ,"You must login!");
    }
    else return 
SCM(playerid ,COLOR ,"USAGE: /help [text]");
    return 
1;

Reply
#3

pawn Код:
CMD:helpme(playerid, params[])
{
    new str[128], Name1[MAX_PLAYER_NAME];
    if(sscanf(params,"s", str))
    {
     SendClientMessage(playerid, COLOR_RED,"CORRECT USAGE: /helpme [text]");
     return 1;
    }
    GetPlayerName(playerid, Name1, sizeof(Name1));
    format(str, sizeof(str),"{00FFFF}[HELP MSG From %s]:{00FFF0} %s",Name1, str);
    MessageToAdmins(COLOR_RED, str);
    SendClientMessage(playerid, yellow,"Your Request has been sent to online Administrators.");
    return 1;
}
MessageToAdmins
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
You need to set that according to your script.
Reply
#4

Quote:
Originally Posted by detter
Посмотреть сообщение
This is onley if you are using sscanaf and zcmd...

PHP код:
CMD:help(playerid ,params[])
{
    new 
msg[128] ,pname[MAX_PLAYER_NAME];
   
GetPlayerName(playeridpnamesizeof(pname));
    if (!
sscanf(params ,"s[128]" ,msg )
    {
        if(
IsPlayerConnected(playerid))
        {
            
format(msg ,sizeof(msg) ,"[HELP] %s [ID:%i]: %s" ,pname ,playerid ,msg);
            
SendClinetMessage(playerid ,COLOR ,"You have sent your message to the admins!");
            
// HERE you can throw in your custom admin check func. or you can just stick with this
            
for(new 0MAX_PLAYERS i++)
            {
                
// change your variable name if its diffrent
                 
if(playerInfo[i][admin] >= 1)
                 {
                      
SendClientMessage(,COLOR ,msg);
                 }
            }
        }
        else return 
SCM(playerid ,COLOR ,"You must login!");
    }
    else return 
SCM(playerid ,COLOR ,"USAGE: /help [text]");
    return 
1;

Thanks for your reply. But

OMG! I have tons of warning like Total War: Shogun!

My gamemode is using zcmd and sscanf. And I think I need to add every variables and other stuff (I forgot) My problem is that I'm using Luxadmin that it not compatible with zcmd and sscanf, I can only use dcmd for that.. What should I do?
Reply
#5

Quote:
Originally Posted by Jarnu
Посмотреть сообщение
pawn Код:
CMD:helpme(playerid, params[])
{
    new str[128], Name1[MAX_PLAYER_NAME];
    if(sscanf(params,"s", str))
    {
     SendClientMessage(playerid, COLOR_RED,"CORRECT USAGE: /helpme [text]");
     return 1;
    }
    GetPlayerName(playerid, Name1, sizeof(Name1));
    format(str, sizeof(str),"{00FFFF}[HELP MSG From %s]:{00FFF0} %s",Name1, str);
    MessageToAdmins(COLOR_RED, str);
    SendClientMessage(playerid, yellow,"Your Request has been sent to online Administrators.");
    return 1;
}
MessageToAdmins
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
You need to set that according to your script.
I have added On top of script (Under my Gamemode)

pawn Код:
new AccInfo[MAXPLAYER];
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (AccInfo[i][Level] >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
After compiling I got warnings:

Код:
error 001: expected token: ")", but found "["
error 029: invalid expression, assumed zero
error 017: undefined symbol "Level"
fatal error 107: too many error messages on one line
Line..

Код:
if(IsPlayerConnected(i) == 1) if (AccInfo[i][Level] >= 1) SendClientMessage(i, COLOR_RED, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)