Originally Posted by biker122
pawn Код:
CMD:bantemp( playerid, params[ ] ) { if(pInfo[playerid][pAdminLevel] >= 2) return SCM(playerid, -1, "You are not authorized to use this command."); new id, reason[64], hours, minutes; if(sscanf( params, "uiis[64]", id, hours, minutes, reason ) ) return SendClientMessage( playerid, -1, "Usage: /ban <Part Of Name> <hours> <minutes> <reason>" ); if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "That player is not connected!" ); new str[ 128 ], pName[ MAX_PLAYER_NAME ], aName[ MAX_PLAYER_NAME ]; GetPlayerName( playerid, aName, MAX_PLAYER_NAME ); GetPlayerName( id, pName, MAX_PLAYER_NAME ); format( str, sizeof( str ), "{a7c0dc}%s was banned temporarily by administrator %s for %i hours and %i minutes (Reason: %s)", pName, aName, hours, minutes, reason ); SendClientMessageToAll( -1, str ); BanPlayerTemp(playerid,reason,aName,hours,minutes); return 1; }
Try to use this command.
Also change the stock like this:
pawn Код:
stock BanPlayerTemp(playerid,reason[],admin[],hours,minutes) { new ppp[50]; new exp=gettime()+(60*minutes)+(60*60*hours); //error line GetPlayerIp(playerid,ppp,sizeof(ppp)); new INI:File = INI_Open(UserBanPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Banexp",exp); INI_WriteInt(File,"BanPerm",0); INI_WriteString(File,"BanAdmin",admin); INI_WriteString(File,"Reason",reason); INI_WriteString(File,"IP",ppp); INI_Close(File); new banmt[300],targetn[MAX_PLAYER_NAME]; GetPlayerName(playerid,targetn,sizeof(targetn)); new INI:iFile = INI_Open(UserIPPath(playerid)); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"Banexp",exp); INI_WriteInt(iFile,"BanPerm",0); INI_WriteString(iFile,"BanPlayer",targetn); INI_WriteString(iFile,"BanAdmin",admin); INI_WriteString(iFile,"Reason",reason); INI_Close(iFile); new File:logg=fopen("BannedPlayers.txt",io_append); fwrite(logg, targetn); fwrite(logg,"\n"); fclose(logg); format(banmt,sizeof(banmt),"{DC143C}Admin %s has banned you for %i hours %i minutes due to %s",admin,hours,minutes,reason); SendClientMessage(playerid,-1,banmt); SetTimerEx("KickPlayer",100,false,"i",playerid); return 1; }
|