Please give me an /ask command code ++REP
#1

Please give me an /ask command code. I really need this. Thanks.
I want the /ask command to be like

"Usage: /ask (question)"
And sends the question to all online admins.

Im using LuxAdmin,, if anyone can give me dcmd format im really thankful.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=187229&page=262
Reply
#3

Try this
pawn Код:
YCMD:ask(playerid, params[])
{
    if(gPlayerLoggedIn[playerid] == 0) return 1;
   
    if(PlayerInfo[playerid][Helper] == 0) {
        new question[128];
        if(sscanf(params, "s[128]", question)) return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /ask [Qusetion]");
        if(PlayerInfo[playerid][nMute] == 1) return SendClientMessage(playerid, COLOR_WHITE, "You are muted from using /ask!");
        foreach(Player, i)
        {
            if(PlayerInfo[i][Helper] > 0)
            {
                new string[126];
                format(string, sizeof(string), "[%d] %s asks: %s", playerid, PlayerName(playerid), question);
                SendClientMessage(i, NEWBIE_COLOR, string);
            }
        }
        SendClientMessage(playerid, COLOR_YELLOW, "You have asked a question, please wait for a response.");
    }
    return 1;
}
Since I dont know your admin codes so change something in it to make it work instead of Helper every where put your code.
pawn Код:
if(PlayerInfo[playerid][Helper] == 0) {
Reply
#4

For command
pawn Код:
dcmd_ask(playerid,params[])
{
    new str[80];
    if(sscanf(params,"s[80]",str)) SendClientMessage(playerid,-1,"Usage : /ask [HELP]");
    new name[MAX_PLAYER_NAME],msg[110];
    GetPlayerName(playerid,name,20);
    format(msg,sizeof(msg),"[HELP]%s(%d) : %s",name,playerid,str);
    for(new i=0;i<MAX_PLAYERS;++i)
    {
        if(IsPlayerConnected(i) && (pInfo[i][Admin] >0 || IsPlayerAdmin(i))
            SendClientMessage(i,-1,msg);
    }
    SendClientMessage(playerid,-1, "You have asked a question, please wait for a response.");

    return 1;
}
If you want it to be like
#Help [Text starting with # goes for Admin help]
pawn Код:
//Under OnPlayerText
public OnPlayerText(playerid, text[])
{
 if(text[0]=='#')
 {
    new i;
    for(i=0;text[i+1]!='\0';++i) text[i] = text[i+1];
    str[i] = '\0'
    new name[MAX_PLAYER_NAME],msg[110];
    GetPlayerName(playerid,name,20);
    format(msg,sizeof(msg),"[HELP]%s(%d) : %s",name,playerid,text);
    for(new i=0;i<MAX_PLAYERS;++i)
    {
        if(IsPlayerConnected(i) && (pInfo[i][Admin] >0 || IsPlayerAdmin(i))
            SendClientMessage(i,-1,msg);
    }
    SendClientMessage(playerid,-1, "You have asked a question, please wait for a response.");
    return 0;
 }
 return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)