[Include] [INC]Simple Reason Include[Good for kick and ban]
#1

REMOVED
Reply
#2

You could already give a sentence as reason.
Anyway nice work.
Reply
#3

Quote:
Originally Posted by FUNExtreme
You could already give a sentence as reason.
Yeah but now it's as simple as
pawn Code:
new Reason[155];
Reason = reason(cmdtext, idx);
And it's done

Quote:
Originally Posted by FUNExtreme
Anyway nice work.
Thanks
Reply
#4

nice one
Reply
#5

max i/o is 128 cells .. please read y_less post so you will catch way

trycatch
{ }
Reply
#6

If you were to use SSCANF you wouldn't have to worry about the reason being a word long, as you could use "z", which would catch all the words and make the reason optional. But if you insist on using strtok I guess this works
Reply
#7

Why do people always get reason with complicated functions!?

It's that easy:

pawn Code:
new cmd[32],tmp[32],idx;

if(!strcmp(cmd,"/kick",true) && IsPlayerAdmin(playerid))
{
    tmp=strtok(cmdtext,idx);
    new id=strval(tmp); // or ReturnUser(tmp);
    if(!IsPlayerConnected(id) || id==playerid || !cmdtext[idx])
        return SendClientMessage(playerid,0xFF0000FF,"Usage: /KICK <ID> <REASON>");

    new string[128];
    GetPlayerName(id,string,sizeof(string));
    format(string,sizeof(string),"*** %s has been kicked. (Reason: %s)",string,cmdtext[idx]);
    SendClientMessageToAll(0xFF0000FF,string);
    Kick(id);      
    return 1;
}
Reply
#8

Here maximal reason ever can be long > 128(max i/o) - (5 + ( /kick + null ) + 3 ( 200 players )) = 120 cells...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)