Error with a commands
#1

When I put the command / ban or /banm, I get this error in the console:

Код:
sscanf warning: Strings without a length are deprecated, please add a destination size.
and on the server I get:

Код:
Server: Unknown command
This is the code of the commands:

Код:
CMD:ban(playerid,parmas[])
{
    if(PlayerInfo[playerid][pStaff] >= 2)
	{
    new tid,du,res[150],ppp[50];
    if(sscanf(parmas,"uis",tid,du,res) || isnull(parmas))return SendClientMessage(playerid,-1,"{ff0000}Uso : /ban id duracion(En dias) Razon");
    if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ff6666}El jugador no esta conectado.");
    new banmt[300],banma[300],adminname[MAX_PLAYER_NAME],targetn[MAX_PLAYER_NAME];
     GetPlayerName(playerid,adminname,sizeof(adminname));
     new exp=gettime()+(60*60*24*du);
     GetPlayerIp(tid,ppp,sizeof(ppp));
     new INI:File = INI_Open(UserBanPath(tid));
     INI_SetTag(File,"data");
     INI_WriteInt(File,"Banexp",exp);
     INI_WriteInt(File,"BanPerm",0);
     INI_WriteString(File,"BanAdmin",adminname);
     INI_WriteString(File,"Reason",res);
     INI_WriteString(File,"IP",ppp);
     INI_Close(File);
     GetPlayerName(tid,targetn,sizeof(targetn));
     new INI:iFile = INI_Open(UserIPPath(tid));
     INI_SetTag(iFile,"data");
     INI_WriteInt(iFile,"Banexp",exp);
     INI_WriteInt(iFile,"BanPerm",0);
     INI_WriteString(iFile,"BanPlayer",targetn);
     INI_WriteString(iFile,"BanAdmin",adminname);
     INI_WriteString(iFile,"Reason",res);
     INI_Close(iFile);
     format(banmt,sizeof(banmt),"{ff0000}Staff %s te ha baneado %i dia(s). Razon: %s",adminname,du,res);
     format(banma,sizeof(banma),"{ff0000}Staff %s ha baneado a %s durante %i dia(s). Razon: %s",adminname,targetn,du,res);
     SendClientMessage(tid,-1,banmt);
     SendClientMessageToAll(-1,banma);
     SetTimerEx("KickPlayer",100,false,"i",tid);
     }
	else SendClientMessage(playerid,-1,"{ff0000}No estas autorizado a usar el comando.");
    return 1;
}
Код:
  CMD:banm(playerid,parmas[])
    {
    if(IsPlayerAdmin(playerid)){
    new tid,h,m,res[150],ppp[50];
    if(sscanf(parmas,"uiis",tid,h,m,res) || isnull(parmas))return SendClientMessage(playerid,-1,"{ff0000}Uso : /banm ID Horas Minutos Razon");
    if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ff6666}El jugador no esta conectado.");
    new banmt[300],banma[300],adminname[MAX_PLAYER_NAME],targetn[MAX_PLAYER_NAME];
     GetPlayerName(playerid,adminname,sizeof(adminname));
     new exp=gettime()+(60*m)+(60*60*h);
     GetPlayerIp(tid,ppp,sizeof(ppp));
     new INI:File = INI_Open(UserBanPath(tid));
     INI_SetTag(File,"data");
     INI_WriteInt(File,"Banexp",exp);
     INI_WriteInt(File,"BanPerm",0);
     INI_WriteString(File,"BanAdmin",adminname);
     INI_WriteString(File,"Reason",res);
     INI_WriteString(File,"IP",ppp);
     INI_Close(File);
     GetPlayerName(tid,targetn,sizeof(targetn));
     new INI:iFile = INI_Open(UserIPPath(tid));
     INI_SetTag(iFile,"data");
     INI_WriteInt(iFile,"Banexp",exp);
     INI_WriteInt(iFile,"BanPerm",0);
     INI_WriteString(iFile,"BanPlayer",targetn);
     INI_WriteString(iFile,"BanAdmin",adminname);
     INI_WriteString(iFile,"Reason",res);
     INI_Close(iFile);
     format(banmt,sizeof(banmt),"{ff0000}Staff %s te ha baneado durante %i hora(s) y %i minuto(s). Razon: %s",adminname,h,m,res);
     format(banma,sizeof(banma),"{ff0000}Staff %s ha baneado a %s durante %i hora(s) y %i minuto(s). Razon: %s",adminname,targetn,h,m,res);
     SendClientMessage(tid,-1,banmt);
     SendClientMessageToAll(-1,banma);
     SetTimerEx("KickPlayer",100,false,"i",tid);
    }else SendClientMessage(playerid,-1,"{ff0000}No estas autorizado a usar este comando.");
    return 1;}
Reply
#2

PHP код:
if(sscanf(params,"uiis[150]",tid,h,m,res
Reply
#3

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
PHP код:
if(sscanf(params,"uiis[150]",tid,h,m,res
I put this and in the console no get a error but in the server no work the command.
Reply
#4

Did it work beforehand? Theory has it that if shouldn't work to start with, if it doesn't work now.
Reply
#5

Quote:
Originally Posted by EnforcerDon
Посмотреть сообщение
Did it work beforehand? Theory has it that if shouldn't work to start with, if it doesn't work now.
I get this command in this FS https://sampforum.blast.hk/showthread.php?tid=503631 and It worked for theirs, but no or my.

Only command it is work is /banperm but the other commands no.
Reply
#6

Any help?
Reply
#7

This isn't going to work well anyways it does nothing to keep them from ban evading. If your not getting any output start putting in print() to figure out which line your code is stopping at.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)