Ban Permanent Problem CMD
#1

can someone help me make this dcmd intro strcmp??please I tried but it didn't work..help me ..PLZ

PHP код:
dcmd_banp(playerid,params[]) //i edited is it good?
                    
{
                        new 
player1;
                        new 
reason[64];
                        if (
sscanf(params"us[128]"player1reason))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"{00A1FF}USAGE{FFFFFF}: /banp [playerid/PartOfName] [motiv]");
                            return 
1;
                        }
                        if(!
IsPlayerConnected(player1))
                        {
                            
SendClientMessage(playeridCOLOR_RED"This Player is not connected.");
                            return 
1;
                        }
                        if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED"You must be administrator level 1 to use that command!");
                        new 
str[128];
                        new 
giveplayerid;
                        new 
giveplayer[MAX_PLAYER_NAME];
                          new 
sendername[MAX_PLAYER_NAME];
                          new 
targetlevel PlayerInfo[giveplayerid][pAdmin];
                        new 
playerlevel PlayerInfo[playerid][pAdmin];
                        if(
targetlevel playerlevel) return SendClientMessage(playeridCOLOR_GREY"* Are functie mai mare decat tine !");
                        if(
FindIP(reason))
                          {
                             new 
advertiser[MAX_PLAYER_NAME];
                             
GetPlayerName(playeridadvertisersizeof(advertiser));
                             
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessageToAll(COLOR_LIGHTGREEN" ");
                            
SendClientMessage(playeridCOLOR_WHITE,"Dute in pula mea de muist sa-ti moara neamu de tigan borat,cretin marsh !");
                               
format(strsizeof(str), "* %s a primit Ban la BOT, motiv: Reclama Server!",advertiser);
                               
SendClientMessageToAll(COLOR_REDstr);
                            
BanLog(str);
                            
Ban(playerid);
                               return 
1;
                        }
                        new 
Player[200], string[128];
                        
format(Player,sizeof(Player),"/NameBan/%s.txt",GetPlayeridName(player1));
                        if(!
dini_Exists(Player))
                        {
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                            
format(string,sizeof(string),"Playername {FF8200}%s {FFFFFF} is added to the ban list."GetPlayeridName(player1));
                            
SendClientMessage(playerid,COLOR_WHITE,string);
                            new 
yearmonth,day;
                            
getdate(yearmonthday);
                            new 
HourMinSec;
                            
gettime(HourMinSec);
                            
format(stringsizeof(string), "AdmCmd: %s a primit Ban Permanent de la  %s, Motiv: %s!",GetPlayeridName(player1), sendername,reason);
                            
SendClientMessageToAll(COLOR_REDstring);
                              new 
ymd;
                            new 
h,mi,s;
                            
getdate(y,m,d);
                            
gettime(h,mi,s);
                            
format(stringsizeof(string), "AdmCmd: %s a primit Ban Permanent pe data de : | %d/%d/%d | ora | %02d:%02d:%02d | ",GetPlayeridName(player1),day,month,year,HourMinSec);
                            
SendClientMessageToAll(COLOR_REDstring);
                            
format(stringsizeof(string), "[%d/%d/%d](%d:%d:%d) AdmCmd: %s a primit Ban Permanent de la  %s, Motiv: %s!",d,m,y,h,mi,s,giveplayersendername,reason);
                            
BanLog(string);
                            if(
giveplayerid == playerid)
                            {
                                 
SendClientMessage(playeridCOLOR_RED,"AdmCmd: Nu iti poti da ban singur.");
                                 return 
1;
                            }
                            new 
pName[MAX_PLAYER_NAME];
                            
GetPlayerName(giveplayerid,pName,MAX_PLAYER_NAME);
                            if(
strcmp(pName,"Mircea") == 0) return SendClientMessage(playerid,-1,"{E60000}ERROR: Nu poti da Ban la Mircea!");
                            if(
strcmp(pName,"Wolf") == 0) return SendClientMessage(playerid,-1,"{E60000}ERROR: Nu poti da Ban la Wolf!");
                            new 
playersip[256];
                            
GetPlayerIp(giveplayerid,playersipsizeof(playersip));
                            
SendClientMessage(giveplayerid,COLOR_BLUE,"|___________[BAN INFO]___________|");
                            
format(stringsizeof(string), "Numele tau este: %s.",GetPlayeridName(player1));
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                            
format(stringsizeof(string), "IP-ul tau este: %s.",playersip);
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                            
format(stringsizeof(string), "Ai fost banat de: %s.",sendername);
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                            
format(stringsizeof(string), "Ai fost banat pentru urmatorul motiv: %s.",reason);
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                            
format(stringsizeof(string), "Ai fost banat pe data de: %d/%d/%d",day,month,year);
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                            
SendClientMessage(giveplayerid,COLOR_BLUE,"|___________[BAN INFO]___________|");
                            
SendClientMessage(giveplayerid,COLOR_WHITE,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este 'www.unionzonerpg.eu/' forum Succes !");
                            
SendClientMessage(giveplayerid,COLOR_WHITE,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza !");
                            
Kick(player1);
                            
dini_Create(Player);
                        }
                        else
                        {
                            
format(string,sizeof(string),"{FF8200}%s{FFFFFF} este deja pe lista de banati."GetPlayeridName(player1));
                            
SendClientMessage(playerid,COLOR_WHITE,string);
                        }
                        return 
1;
                    } 
Reply
#2

anyone please help?sorry for bump
Reply
#3

Start by this snippet, but I don't suggest at ALL to convert any of your codes to strcmp. I personally suggest using ZCMD, but anyway, use this as a start
pawn Код:
if (strcmp("/yourcommandhere", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_RED,"This is a test command");
        return 1;
    }
Reply
#4

but what does Player and Player1 mean?i want it to be strcmp because I understand it..and its easy for me..
Reply
#5

Код:
if (strcmp("/banp", cmdtext, true, 5) == 0)
{
                        new player1; 
                        new reason[64]; 
                        if (sscanf(params, "us[128]", player1, reason)) 
                        { 
                            SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /banp [playerid/PartOfName] [motiv]"); 
                            return 1; 
                        } 
                        if(!IsPlayerConnected(player1)) 
                        { 
                            SendClientMessage(playerid, COLOR_RED, "This Player is not connected."); 
                            return 1; 
                        } 
                        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED, "You must be administrator level 1 to use that command!"); 
                        new str[128]; 
                        new giveplayerid; 
                        new giveplayer[MAX_PLAYER_NAME]; 
                          new sendername[MAX_PLAYER_NAME]; 
                          new targetlevel = PlayerInfo[giveplayerid][pAdmin]; 
                        new playerlevel = PlayerInfo[playerid][pAdmin]; 
                        if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* Are functie mai mare decat tine !"); 
                        if(FindIP(reason)) 
                          { 
                             new advertiser[MAX_PLAYER_NAME]; 
                             GetPlayerName(playerid, advertiser, sizeof(advertiser)); 
                             SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessageToAll(COLOR_LIGHTGREEN, " "); 
                            SendClientMessage(playerid, COLOR_WHITE,"Dute in pula mea de muist sa-ti moara neamu de tigan borat,cretin marsh !"); 
                               format(str, sizeof(str), "* %s a primit Ban la BOT, motiv: Reclama Server!",advertiser); 
                               SendClientMessageToAll(COLOR_RED, str); 
                            BanLog(str); 
                            Ban(playerid); 
                               return 1; 
                        } 
                        new Player[200], string[128]; 
                        format(Player,sizeof(Player),"/NameBan/%s.txt",GetPlayeridName(player1)); 
                        if(!dini_Exists(Player)) 
                        { 
                            GetPlayerName(playerid, sendername, sizeof(sendername)); 
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); 
                            format(string,sizeof(string),"Playername {FF8200}%s {FFFFFF} is added to the ban list.", GetPlayeridName(player1)); 
                            SendClientMessage(playerid,COLOR_WHITE,string); 
                            new year, month,day; 
                            getdate(year, month, day); 
                            new Hour, Min, Sec; 
                            gettime(Hour, Min, Sec); 
                            format(string, sizeof(string), "AdmCmd: %s a primit Ban Permanent de la  %s, Motiv: %s!",GetPlayeridName(player1), sendername,reason); 
                            SendClientMessageToAll(COLOR_RED, string); 
                              new y, m, d; 
                            new h,mi,s; 
                            getdate(y,m,d); 
                            gettime(h,mi,s); 
                            format(string, sizeof(string), "AdmCmd: %s a primit Ban Permanent pe data de : | %d/%d/%d | ora | %02d:%02d:%02d | ",GetPlayeridName(player1),day,month,year,Hour, Min, Sec); 
                            SendClientMessageToAll(COLOR_RED, string); 
                            format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) AdmCmd: %s a primit Ban Permanent de la  %s, Motiv: %s!",d,m,y,h,mi,s,giveplayer, sendername,reason); 
                            BanLog(string); 
                            if(giveplayerid == playerid) 
                            { 
                                 SendClientMessage(playerid, COLOR_RED,"AdmCmd: Nu iti poti da ban singur."); 
                                 return 1; 
                            } 
                            new pName[MAX_PLAYER_NAME]; 
                            GetPlayerName(giveplayerid,pName,MAX_PLAYER_NAME); 
                            if(strcmp(pName,"Mircea") == 0) return SendClientMessage(playerid,-1,"{E60000}ERROR: Nu poti da Ban la Mircea!"); 
                            if(strcmp(pName,"Wolf") == 0) return SendClientMessage(playerid,-1,"{E60000}ERROR: Nu poti da Ban la Wolf!"); 
                            new playersip[256]; 
                            GetPlayerIp(giveplayerid,playersip, sizeof(playersip)); 
                            SendClientMessage(giveplayerid,COLOR_BLUE,"|___________[BAN INFO]___________|"); 
                            format(string, sizeof(string), "Numele tau este: %s.",GetPlayeridName(player1)); 
                            SendClientMessage(giveplayerid, COLOR_WHITE, string); 
                            format(string, sizeof(string), "IP-ul tau este: %s.",playersip); 
                            SendClientMessage(giveplayerid, COLOR_WHITE, string); 
                            format(string, sizeof(string), "Ai fost banat de: %s.",sendername); 
                            SendClientMessage(giveplayerid, COLOR_WHITE, string); 
                            format(string, sizeof(string), "Ai fost banat pentru urmatorul motiv: %s.",reason); 
                            SendClientMessage(giveplayerid, COLOR_WHITE, string); 
                            format(string, sizeof(string), "Ai fost banat pe data de: %d/%d/%d",day,month,year); 
                            SendClientMessage(giveplayerid, COLOR_WHITE, string); 
                            SendClientMessage(giveplayerid,COLOR_BLUE,"|___________[BAN INFO]___________|"); 
                            SendClientMessage(giveplayerid,COLOR_WHITE,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este 'www.unionzonerpg.eu/' forum Succes !"); 
                            SendClientMessage(giveplayerid,COLOR_WHITE,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza !"); 
                            Kick(player1); 
                            dini_Create(Player); 
                        } 
                        else 
                        { 
                            format(string,sizeof(string),"{FF8200}%s{FFFFFF} este deja pe lista de banati.", GetPlayeridName(player1)); 
                            SendClientMessage(playerid,COLOR_WHITE,string); 
                        } 
                        return 1; 
                    }
Reply
#6

and params??this is not good..
Reply
#7

if(!strcmp(cmdtext, "/banp", true, 5))
change if (sscanf(params, "us[128]", player1, reason)) ===> if(!cmdtext[5])

or use https://sampwiki.blast.hk/wiki/Strtok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)