How to create the following commands?
#1

INCLUDES
y_ini
sscanf2
zcmd


Commands
/requesthelp - for players(this is very common though.)
/accepthelp - for the admins to accept the /requesthelp of players
Reply
#2

PHP код:
COMMAND:ask(playeridparams[]) // change ask to whatever you want
{
    if(
PlayerLogged[playerid] == 1//depending on your system
    
{
        new 
Message[100];
        if(!
sscanf(params"s[100]",Message))
        {
            new 
name[MAX_PLAYER_NAME], send[100];
            
GetPlayerName(playeridnamesizeof(name));
            
format(sendsizeof(send), "%s(%d) asked: %s"nameplayeridMessage);
            
SendMessageToAdmins(redsend); //this is used in fAdmin
            
SendClientMessage(playeridCOLOR_GREEN"Question sent!");
        }
    }

PHP код:
COMMAND:res(playerid,params[]) //change to whatever you want
{
    if(
PlayerAcc[playerid][AdminLevel] >=1//admin thing
    
{
        if(
PlayerLogged[playerid] == 1//depending on your system
        
{
            new 
pid;
            new 
message[100];
            if(
sscanf(params"us[32]"pidmessage))
            {
                return 
SendClientMessage(playeridCOLOR_YELLOW"USAGE: /res <playerid> <message>");
            }
            if(
pid == INVALID_PLAYER_IDSendClientMessage(playerid,red,"ERROR: Wrong player ID");
            new 
pmsg[256];
            
format(pmsg,sizeof(pmsg),"Admin Respond: %s",message);
            new 
pidmsg[256];
            new 
pidname[MAX_PLAYER_NAME];
            
GetPlayerName(pid,pidname,sizeof(pidname));
            
format(pidmsg,sizeof(pidmsg),"Respond sent to %s(%d): %s",pidname,pid,message);
            
SendClientMessage(pidCOLOR_ORANGEpmsg);
            
PlayerPlaySound(pid,1057,0.0,0.0,0.0);
            
SendClientMessage(playeridCOLOR_ORANGEpidmsg);
        }
        else 
SendClientMessage(playerid,red,"ERROR: You must be an Admin level 1 or higher to perform this command!");
    }
    else 
SendClientMessage(playerid,COLOR_RED,"SERVER: You must be logged in to perform this command!");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)