/ahelp shows nothing
#1

When I do /ahelp nothing comes up, howcome there's nothing coming up?

PHP код:
    if(strcmp(cmd"/askadmin"true) == || strcmp(cmd"/ahelp"true) == 0)
    {
        if(!
strlen(cmdtext[8])) return SendClientMessage(playerid0xFF0000AA"Use /ahelp [message]");
        new 
str[128];
        if((
gettime()-LastReport[playerid]) < 30)
        {
            
format(str128"You have to wait %d seconds before you can send a new help message!", (30-(gettime()-LastReport[playerid])));
            
SendClientMessage(playerid0xFF0000AAstr); return 1;
        }
        
format(str128"[ASKADMIN] Sender ID: %d. Message: %s"playeridcmdtext[8]);
        for(new 
ii<MAX_PLAYERSi++)
        {
            
AdministratorMessage(COLOR_ADMINCMDstring,1);
            return 
1;
        }
        
SendClientMessage(playerid0x00FF00AA"Help sent to online admins!");
        
LastReport[playerid] = gettime();
        return 
1;
    } 
Reply
#2

Try to use sscanf2 and ZCMD...

Anyway...

Try to debug it..
Reply
#3

that doesn't actually help.
Reply
#4

it helps

debug that command
Reply
#5

Isn't gettime supposed to have 3 parameters? gettime(&hour, &minute, &second);?

I'm surprised that even compiles...

https://sampwiki.blast.hk/wiki/Gettime
Reply
#6

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Isn't gettime supposed to have 3 parameters? gettime(&hour, &minute, &second);?

I'm surprised that even compiles...

https://sampwiki.blast.hk/wiki/Gettime
Well it actually compiles, can you code it for me? as i don't actually get what to do now.
Reply
#7

pawn Код:
if(strcmp(cmd, "/askadmin", true) == 0 || strcmp(cmd, "/ahelp", true) == 0)
{
    if(!strlen(cmdtext[8])) return SendClientMessage(playerid, 0xFF0000AA, "Use /ahelp [message]");
    new str[128];
    if((getseconds()-LastReport[playerid]) < 30)
    {
        format(str, 128, "You have to wait %d seconds before you can send a new help message!", (30-(gettime()-LastReport[playerid])));
        SendClientMessage(playerid, 0xFF0000AA, str); return 1;
    }
    format(str, 128, "[ASKADMIN] Sender ID: %d. Message: %s", playerid, cmdtext[8]);
    for(new i; i<MAX_PLAYERS; i++)
    {
        AdministratorMessage(COLOR_ADMINCMD, string,1);
        return 1;
    }
    SendClientMessage(playerid, 0x00FF00AA, "Help sent to online admins!");
    LastReport[playerid] = getseconds();
    return 1;
}

stock getseconds()
{
    new _h, _m, _s;
    gettime(_h, _m, _s);
    return s;
}
Try this. I haven't tested it, but I've simply made a "getseconds" function that does the same as what you were attempting.
Reply
#8

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Isn't gettime supposed to have 3 parameters? gettime(&hour, &minute, &second);?

I'm surprised that even compiles...

https://sampwiki.blast.hk/wiki/Gettime
Sorry, but you are wrong. If no parameters are passed to gettime, it will return the current Unix-Timestamp

OT:

pawn Код:
if(strcmp(cmd, "/askadmin", true) == 0 || strcmp(cmd, "/ahelp", true) == 0)
    {
        if(!strlen(cmdtext[8])) return SendClientMessage(playerid, 0xFF0000AA, "Use /ahelp [message]");
        new str[128];
        if((gettime()-LastReport[playerid]) < 30)
        {
            format(str, 128, "You have to wait %d seconds before you can send a new help message!", (30-(gettime()-LastReport[playerid])));
            SendClientMessage(playerid, 0xFF0000AA, str); return 1;
        }
        format(str, 128, "[ASKADMIN] Sender ID: %d. Message: %s", playerid, cmdtext[8]);
        //Loop not needed, it was also making a part of code unreachable
        AdministratorMessage(COLOR_ADMINCMD, str, 1); //You saved the message in "str" but you were sending "string"
        SendClientMessage(playerid, 0x00FF00AA, "Help sent to online admins!");
        LastReport[playerid] = gettime();
        return 1;
    }
Reply
#9

Quote:
Originally Posted by OPremium
Посмотреть сообщение
Sorry, but you are wrong. If no parameters are passed to gettime, it will return the current Unix-Timestamp

OT:

pawn Код:
if(strcmp(cmd, "/askadmin", true) == 0 || strcmp(cmd, "/ahelp", true) == 0)
    {
        if(!strlen(cmdtext[8])) return SendClientMessage(playerid, 0xFF0000AA, "Use /ahelp [message]");
        new str[128];
        if((gettime()-LastReport[playerid]) < 30)
        {
            format(str, 128, "You have to wait %d seconds before you can send a new help message!", (30-(gettime()-LastReport[playerid])));
            SendClientMessage(playerid, 0xFF0000AA, str); return 1;
        }
        format(str, 128, "[ASKADMIN] Sender ID: %d. Message: %s", playerid, cmdtext[8]);
        //Loop not needed, it was also making a part of code unreachable
        AdministratorMessage(COLOR_ADMINCMD, str, 1); //You saved the message in "str" but you were sending "string"
        SendClientMessage(playerid, 0x00FF00AA, "Help sent to online admins!");
        LastReport[playerid] = gettime();
        return 1;
    }
Ooh... Never knew that! D:

Now I do; I always wondered why the parameters that it requested (in Notepad++ and Pawno) had defaults!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)