20.10.2014, 23:27
When I put the command / ban or /banm, I get this error in the console:
and on the server I get:
This is the code of the commands:
Код:
sscanf warning: Strings without a length are deprecated, please add a destination size.
Код:
Server: Unknown command
Код:
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;}