SA-MP Forums Archive
/ahelp shows nothing - 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: /ahelp shows nothing (/showthread.php?tid=301728)



/ahelp shows nothing - FabianoC - 05.12.2011

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;
    } 



Re: /ahelp shows nothing - Speed - 05.12.2011

Try to use sscanf2 and ZCMD...

Anyway...

Try to debug it..


Re: /ahelp shows nothing - FabianoC - 05.12.2011

that doesn't actually help.


Re: /ahelp shows nothing - Speed - 05.12.2011

it helps

debug that command


Re: /ahelp shows nothing - Ash. - 05.12.2011

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

I'm surprised that even compiles...

https://sampwiki.blast.hk/wiki/Gettime


Re: /ahelp shows nothing - FabianoC - 05.12.2011

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.


Re: /ahelp shows nothing - Ash. - 05.12.2011

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.


Respuesta: /ahelp shows nothing - OPremium - 05.12.2011

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;
    }



Re: Respuesta: /ahelp shows nothing - Ash. - 05.12.2011

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!