I have this problem with /ban and reason
#3

No way that a simple ban command with reason will take so many lines in my script .
I remember One time I made ban command with reason by using strtok and it worked.

I can use scanff but I dont want to use it in my script.

And why now 256 cells ? (at the strings)

Edit :
Dude thanks alot but I got a better command in an easier way and it tottaly works
PHP код:
    if(strcmp(cmd,"/ban",true) == 0) 
    { 
        if(
PlayerInfo[playerid][pAdminLevel] > 1) 
        { 
        new 
tmp[256],tmp2[256],adminname[MAX_PLAYER_NAME],victim,victimname[MAX_PLAYER_NAME],string[256],string2[256]; 
        
tmp = strtok(cmdtext, idx); 
        
tmp2 = strtok(cmdtext, idx); 
        if(
strlen(tmp) == 0) return SendClientMessage(playerid,COLOR_RED," : Usage : /ban [PLAYERID][REASON]"); 
        if(
strlen(tmp2) == 0) return SendClientMessage(playerid,COLOR_RED,": Usage : /ban [PLAYERID][REASON]"); 
        
victim = strval(tmp); 
        
GetPlayerName(victim,victimname,sizeof(victimname)); 
        
GetPlayerName(playerid,adminname,sizeof(adminname)); 
        
format(string,sizeof(string)," : You have banned : %s",victimname); 
        new 
reason[256]; 
        
reason = tmp2; 
        
format(string2,sizeof(string2),"Player %s Has been banned by admin : MR.%s . Reason : %s",victimname,adminname,reason); 
        if(
victim != INVAILD_PLAYER_ID        { 
        
SendClientMessageToAll(COLOR_RED,string2); 
        
Ban(strval(tmp)); 
        } 
       else
        {
        
SendClientMessage(playerid,COLOR_RED," This player is not logged in"); 
        }
        } 
         if(
PlayerInfo[playerid][pAdminLevel] < 2) 
        { 
            
SendClientMessage(playerid,COLOR_AFOR,"You are not authorized to use this command"); 
        } 
    } 
Reply


Messages In This Thread
I have this problem with /ban and reason - by bijoyekuza - 27.02.2011, 18:46
Re: I have this problem with /ban and reason - by pawn_ - 27.02.2011, 19:00
Re: I have this problem with /ban and reason - by bijoyekuza - 28.02.2011, 13:08

Forum Jump:


Users browsing this thread: 1 Guest(s)