Temp ban
#1

Hey guys iam using this fs

https://sampforum.blast.hk/showthread.php?tid=592351

and added it on my gamemode

So

PHP код:
CMD:tempban(playerid,params[]) {
        if(
IsPlayerAdmin(playerid)) {
            new 
strdate[3000],strtime[3000], player1w[3000], reason[3000], byearw[3000],bmonthw[3000],bdayw[3000], Index;
             
player1w strtok(params,Index), reason strtok(params,Index); byearw strtok(params,Index), bmonthw strtok(params,Index), bdayw strtok(params,Index);
                    if(!
strlen(player1w)) {
                        
SendClientMessage(playerid0xDC143CAA"USAGE: /tempban [playerid] [reason] [years months days]");
                        return 
SendClientMessage(playerid0xFF9900AA"Example: /tempban 1 example 0 0 6 [ player will be banned for six days ]");
                        }
                        if(!
strlen(reason)) return SendClientMessage(playeridred"ERROR: You must give a reason");
 
            if(!
strlen(byearw)) return SendClientMessage(playeridred"ERROR: You must give a year");
            if(!
strlen(bmonthw)) return SendClientMessage(playeridred"ERROR: You must give a month");
            if(!
strlen(bdayw)) return SendClientMessage(playeridred"ERROR: You must give a day");
           
            new 
player1n,byearn,bmonthn,bdayn,ip[128], string[150];
            
player1n strval(player1w); byearn strval(byearw); bmonthn strval(bmonthw); bdayn strval(bdayw);
                       
                        if(
IsPlayerConnected(player1n) && player1n != INVALID_PLAYER_ID) {
                                
GetPlayerIp(playerid,ip,sizeof(ip));
                                new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
                                
format(string,sizeof(string),"|- %s has been temporary banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d] -|",pName(player1n),pName(playerid),params[2],day,month,year,hour,minuite);
                                
SendClientMessageToAll(COLOR_Silver,string);
                                print(string);
                                
format(strdatesizeof(strdate), "%d-%d-%d ",year,month,day);
                                
format(strtime,sizeof(strtime),"%d:%d:%d",hour,minuite,second);
                                new 
tempbandate[3],bandate[128];
                                
tempbandate[0] = year+byearntempbandate[1] = month+bmonthntempbandate[2] = day+bdayn;
                                
format(bandate,sizeof bandate,"%d-%d-%d",tempbandate[0],tempbandate[1],tempbandate[2]);
                new 
Query[250];
 
                
format(Querysizeof(Query), "UPDATE `banneds` SET `ip` = '%s', `date` = '%s', `time` = '%s', `bannedby` = '%s', `tempban` = '%d', `reason` = '%s', `bdate` = '%s' WHERE `name` = '%s'"ip,strdate,strtime,pName(playerid),1,params[2],bandate,pName(player1n));
                
mysql_tquery(mysqlQuery""""); printf("%s",Query); totalbans ++;
                
format(Querysizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",ip);
                    
mysql_tquery(mysqlQuery""""); totalip ++;
 
                                return 
SetTimerEx("kickplayer"500false"i"player1n);
                        } else return 
SendClientMessage(playerid0xDC143CAA"Player is not connected or is yourself or is the highest level admin");
        } else return 
SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");

In game when i type /tempban it gives me unknown command whats the problem
Reply
#2

Error 102: processing failed.

Sorry but the code makes me very sleepy because it's very unreadable, either because [.code] decided to not read it well enough or because of the way it has been coded and I'm guessing it's a bit of both maybe?

So my suggestion would be to start deleting parts of code and just go by trial and error. Alternatively start from scratch and create line by line until it stops working.
Reply
#3

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
Error 102: processing failed.

Sorry but the code makes me very sleepy because it's very unreadable, either because [.code] decided to not read it well enough or because of the way it has been coded and I'm guessing it's a bit of both maybe?

So my suggestion would be to start deleting parts of code and just go by trial and error. Alternatively start from scratch and create line by line until it stops working.
The problem is it compile fine but not working in the server
Reply
#4

Exactly... There is something wrong, usually an array going out of its index range etc. Well it's up to you how you want to find it but again I suggest trial and error method! :P Or you can just wait for someone to just hand it to you on a plate, choice is yours bud! :3
Reply
#5

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
Exactly... There is something wrong, usually an array going out of its index range etc. Well it's up to you how you want to find it but again I suggest trial and error method! :P Or you can just wait for someone to just hand it to you on a plate, choice is yours bud! :3
Look, i tried to create my own ban system but i failed cause of temp and how to save it in the mysql.
So, when i searched i found this fs
Reply
#6

Hey problem from R41-2 because i converted from R39-3 to R41-2
What should i do?
Reply
#7

Any help?
Problem from updating r39 to r40 idk why
Reply
#8

There has to be a way to fix that, Maybe there is a problem compiling it or you made a mistake on the code
Reply
#9

Quote:
Originally Posted by zedshadowzw
Посмотреть сообщение
There has to be a way to fix that, Maybe there is a problem compiling it or you made a mistake on the code
it compile fine but idk what is happening
Reply
#10

Quote:
Originally Posted by Loinal
Посмотреть сообщение
it compile fine but idk what is happening
That's really fucked up, never experienced it before..
I'll PM you when I found a solution
glad to help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)