Smile - Question
#1

ban i give ban to a player and it bans him on ip and not on name please help..someone told me that its alread on name..


PHP код:
if(strcmp(cmd"/ban"true) == 0)
                    {
                    
tmp strtok(cmdtextidx);
                    if(!
strlen(tmp))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /ban [playerid/PartOfName] [reason]");
                        return 
1;
                    }
                    
giveplayerid ReturnUser(tmp);
                     if (
PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        if(
IsPlayerConnected(giveplayerid))
                        {
                            if(
giveplayerid != INVALID_PLAYER_ID)
                            {
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                
GetPlayerName(playeridsendernamesizeof(sendername));
                                new 
length strlen(cmdtext);
                                while ((
idx length) && (cmdtext[idx] <= ' '))
                                {
                                    
idx++;
                                }
                                new 
offset idx;
                                new 
result[64];
                                while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                                {
                                    
result[idx offset] = cmdtext[idx];
                                    
idx++;
                                }
                                
result[idx offset] = EOS;
                                if(!
strlen(result))
                                {
                                    
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /ban [playerid/PartOfName] [reason]");
                                    return 
1;
                                }
                                new 
yearmonth,day;
                                
getdate(yearmonthday);
                                new 
HourMinSec;
                                
gettime(HourMinSec);
                                
format(stringsizeof(string), "AdmCmd: %s a primit Ban de la  %s, Motiv: %s!",giveplayersendername,(result));
                                
SendClientMessageToAll(COLOR_REDstring);
                                
BanLog(string);
                                
format(stringsizeof(string), "AdmCmd: %s a primit Ban pe data de : | %d/%d/%d | ora | %02d:%02d:%02d | ",giveplayer,day,month,year,HourMinSec);
                                
SendClientMessageToAll(COLOR_REDstring);
                                new 
playersip[256];
                                
GetPlayerIp(giveplayerid,playersipsizeof(playersip));
                                
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE,"|___________[BAN INFO]___________|");
                                
format(stringsizeof(string), "Numele tau este: %s.",giveplayer);
                                
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
                                
format(stringsizeof(string), "IP-ul tau este: %s.",playersip);
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), "Ai fost banat de: %s.",sendername);
                                
SendClientMessage(giveplayeridCOLOR_REDstring);
                                
format(stringsizeof(string), "Ai fost banat pentru urmatorul motiv: %s.",(result));
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), "Ai fost banat pe data de: %d/%d/%d",day,month,year);
                                
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
                                
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE,"|___________[BAN INFO]___________|");
                                
SendClientMessage(giveplayerid,COLOR_YELLOW,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este {www.eurounion.sampforum.net/} 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 !");
                                
Ban(giveplayerid);
                                return 
1;
                            }
                        }
                    }
                    return 
1;
                    } 
Reply
#2

You have to make your own ban system, it's much easier with mysql, or y_ini is good too, but after you got your ban system, you just add ip's to that database, then onplayerconnect check their IP, if it matches an IP on the ban database, simply kick(playerid), it's easy once you get to know it.
Reply
#3

i know with strcmp..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)