error 033: array must be indexed (variable "minutes")
#1

Code:
PHP код:
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(loggtargetn);
    
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);

Reply
#2

Heres the cmd that using that stock:
PHP код:
CMD:bantempplayeridparams[ ] )
{
    if(
pInfo[playerid][pAdminLevel] >= 2) return SCM(playerid, -1"You are not authorized to use this command.");
    new 
idreason[64];
    if(
sscanfparams"us[64]"idreason ) ) return SendClientMessageplayerid, -1"Usage: /ban <Part Of Name> <hours> <minutes> <reason>" );
    if( !
IsPlayerConnectedid ) || id == INVALID_PLAYER_ID ) return SendClientMessageplayerid, -1"That player is not connected!" );
    new 
str128 ], pNameMAX_PLAYER_NAME ], aNameMAX_PLAYER_NAME ],hours,minutes;
    
GetPlayerNameplayeridaNameMAX_PLAYER_NAME );
    
GetPlayerNameidpNameMAX_PLAYER_NAME );
    
formatstrsizeofstr ), "{a7c0dc}%s was banned temporarily by administrator %s for %i hours and %i minutes (Reason: %s)"pNameaNamehoursminutesreason );
    
SendClientMessageToAll( -1str );
    
BanPlayerTemp(playerid,reason,aName,hours,minutes);
    return 
1;

Also, im using TimeStampToDate
Reply
#3

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;
}
Reply
#4

Quote:
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;
}
Same.
Reply
#5

Ok, I Fixed it, i just changed ( playerid, parmas[ ] ) to (playerid, params[])

BTW, thanks for your concern biker122 +1
Reply
#6

It's not actually the same. Check the code fully once.

Quote:

i just changed ( playerid, params[ ] ) to (playerid, params[])

Are you even serious?
Reply
#7

Quote:
Originally Posted by biker122
Посмотреть сообщение
It's not actually the same. Check the code fully once.


Are you even serious?
He put a space between the []
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)