SA-MP Forums Archive
Bugged Cmd (/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: Bugged Cmd (/ask) (/showthread.php?tid=547793)



Bugged Cmd (/ask) - Snail - 25.11.2014

Hey guys, I'm experiencing a bug in my command which is /ask
When a player uses it it sends it to online admins but doesn't show their question..
Could somebody please help ?



pawn Код:
CMD:ask(playerid,params[]) {
    new question[128], asker[MAX_PLAYER_NAME], str[128];
    if(isnull(params)) return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,question);
    MessageToAdmins(COLOR_WHITE,str);
    return SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
}
Thanks


Re: Bugged Cmd (/ask) - Youice - 25.11.2014

pawn Код:
CMD:ask(playerid,params[]) {
    new question[128], asker[MAX_PLAYER_NAME], str[128];
    if(isnull(params)) return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,question);
    MessageToAdmins(COLOR_WHITE,str);
    SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
    return 1;
}



Re: Bugged Cmd (/ask) - Write - 25.11.2014

^ Youice was quicker.


Re: Bugged Cmd (/ask) - Snail - 25.11.2014

Still bugged..


Re: Bugged Cmd (/ask) - Write - 25.11.2014

Oh, I didn't notice that you're making the variable "question" but not using it.
pawn Код:
CMD:ask(playerid,params[])
{    
    new question[128], asker[MAX_PLAYER_NAME], str[128];
    if(sscanf(params, "s[128]", question))  return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,question);
    MessageToAdmins(COLOR_WHITE,str);
    SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
    return 1;
}

or if you dont have sscanf

CMD:ask(playerid,params[])
{    
    new asker[MAX_PLAYER_NAME], str[128];
    if(isnull(params))  return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,params);
    MessageToAdmins(COLOR_WHITE,str);
    SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
    return 1;
}



Re: Bugged Cmd (/ask) - Snail - 25.11.2014

Quote:
Originally Posted by Turn
Посмотреть сообщение
Oh, I didn't notice that you're making the variable "question" but not using it.
pawn Код:
CMD:ask(playerid,params[])
{    
    new question[128], asker[MAX_PLAYER_NAME], str[128];
    if(sscanf(params, "s[128]", question))  return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,question);
    MessageToAdmins(COLOR_WHITE,str);
    SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
    return 1;
}

or if you dont have sscanf

CMD:ask(playerid,params[])
{    
    new asker[MAX_PLAYER_NAME], str[128];
    if(isnull(params))  return SendClientMessage(playerid, red, "Usage: /ask <question>");
    GetPlayerName(playerid, asker, sizeof(asker));
    format(str, sizeof(str), "||NewReport||  %s(%d) asks: %s",asker,playerid,params);
    MessageToAdmins(COLOR_WHITE,str);
    SendClientMessage(playerid,yellow, "Your question has been sent to online administrators.");
    return 1;
}
Thank you very much