Need help to fix some command.
#1

So i have command like /ask peoples to ask questions and admins to read but i need something one time i created
it with timer btw it was not good


pawn Код:
if(strcmp(cmd,"/p",true)==0 || strcmp(cmd,"/pitaj",true)==0 || strcmp(cmd,"/ask",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Use: /pitaj [text]");
                return 1;
            }
            format(string, sizeof(string), "Question from %s-a: %s", sendername, (result));
            ABroadCast(COLOR_YELLOW2,string,1);
            SendClientMessage(playerid, COLOR_YELLOW2, "Your question is sended to admins.");
        }
        return 1;
    }
Reply
#2

Please use more details and better English.
Reply
#3

Quote:
Originally Posted by maramizo
Посмотреть сообщение
Please use more details and better English.
So you dont understand

1. I create a command which is for questions Insertion (like on some servers /askq)
2. But peoples spaming so i want to add 1min waiting before again type /askq question.
3. One time i have tried with Settimerex but there was problem.

So really need this anyone to answer. Thanks!
Reply
#4

pawn Код:
new WaitforAsk[MAX_PLAYERS];
forward Wait(playerid);

public OnPlayerCommandText(...)
{
if(strcmp(cmd,"/p",true)==0 || strcmp(cmd,"/pitaj",true)==0 || strcmp(cmd,"/ask",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Use: /pitaj [text]");
                return 1;
            }
            if(WaitForAsk[playerid] == 1)
            {
                SendClientMessage(playerid,color,"You must wait 60 seconds to ask another question !");
                return 1;
            }
            format(string, sizeof(string), "Question from %s-a: %s", sendername, (result));
            ABroadCast(COLOR_YELLOW2,string,1);
            WaitForAsk[playerid] = 1;
            SetTimerEx("Wait",60*1000,true,"i",playerid);
            SendClientMessage(playerid, COLOR_YELLOW2, "Your question is sended to admins.");
        }
        return 1;
    }
   

public Wait(playerid)
{
       WaitForAsk[playerid] = 0;
       SendClientMessage(playerid,COLOR,"Feel free to use /askq again!");
}
Reply
#5

Btw one problem when i type /pitaj question its typed 2 times why?
Reply
#6

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)