SA-MP Forums Archive
/ask - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /ask (/showthread.php?tid=406353)



/ask - DerickClark - 10.01.2013

i can't find a /ask
For Admin
Player Can do /ask
the admin's can help them.


Re: /ask - mastermax7777 - 10.01.2013

Using zcmd, and sscanf
pawn Код:
CMD:ask(playerid, params[])
{
    new string[128], pname[24];
    if(!sscanf(params,"s[128]",string))
    {
        GetPlayerName(playerid, pname, 24);
        format(string,128,"[ASK] %s is asking: %s",pname,string);
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(IsPlayerAdmin(i)) SendClientMessage(i, -1, string);
        }
    }
    else SendClientMessage(playerid, 0xFF0000AA, "Usage: /ASK [Message]");
}



Re: /ask - DerickClark - 10.01.2013

The command don't wanna work.


Re: /ask - Skyrise - 10.01.2013

pawn Код:
if(IsPlayerAdmin(i))
This will send it to any RCON admins. (which means you must be logged in RCON)

Edit:

You can change it, using what your script sets for admin.

i.e., on my server it would be like this

pawn Код:
if(pInfo[i][pAdmin] >= 1)



Re: /ask - ThePhenix - 10.01.2013

PHP код:
if(PlayerInfo[i][pAdmin] >= || IsPlayerAdmin(i)) 



Re: /ask - Skyrise - 10.01.2013

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
PHP код:
if(PlayerInfo[i][pAdmin] >= || IsPlayerAdmin(i)) 
This would also make it work for RCON admins AND normal admins.


Re: /ask - ThePhenix - 10.01.2013

PHP код:
CMD:ask(playeridparams[])
{
    new 
text[128]; //Variable text
    
new string[256];
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));
        
//You need sscanf2 include, sscanf plugin.
    
if(sscanf(params"s[128]"text)) return SendClientMessage(playerid, -1"USAGE: /ask [text]");
    for(new 
i=0;i<MAX_PLAYERS;i++)
        {
        if(
PlayerInfo[i][pAdmin] >= || IsPlayerAdmin(i))
        {
        
format(stringsizeof(string),"Player %s asks %s"Nametext);
        
SendClientMessage(i, -1string);
        }
    }
    return 
1;




Re: /ask - DerickClark - 10.01.2013

It work ,i'm going to test it.i hope dis do.
Thanks everone .


Edit"
Can i change the color's of the text?


Re: /ask - Skyrise - 10.01.2013

the -1 in SendClientMessage is where you can put the color.

pawn Код:
//With your defines
#define COL_YEL 0xFFFF0000 // Color Yellow
SendClientMessage(i, COL_YEL, string);