20.02.2018, 16:17
Can anyone find what's wrong with this cmd? It's a command from our server.
Quote:
CMD:tempban(playerid,parmas[]) { if (PInfo[playerid][Admin] < 3) return SendClientMessage(playerid, RED,"[ERROR]: {FFFFFF}You do not have the privilleges to perform this command."); new tid,du,res[150],ppp[50]; if(sscanf(parmas,"uis",tid,du,res) || isnull(parmas))return SendClientMessage(playerid,TOMATO,"[USAGE]: {FFFFFF}/tempban (OkayerID) (Days) (Reason)"); if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ff6666}The Player you requested is not connected."); new 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); new File:logg=fopen("BannedPlayers.txt",io_append); fwrite(logg, targetn); fwrite(logg,"\n"); fclose(logg); new string[500]; SendClientMessage(playerid, TOMATO,"[TEMPBAN]: {FFFFFF}The selected account has been temp banned from the database."); format(string,sizeof(string),"[ADMIN ACTION]: {FFFFFF}Administrator %s has banned %s(%d) from the server for %i days. Reason: %s.",GetName(playerid), GetName(tid),tid,du,res); SendClientMessageToAll(COLOR_ADMIN,string); SetTimerEx("KickPlayer",100,false,"i",tid); return 1; } |