Unavle to compile script.
#1

Hello i am having these errors while trying to compile.

Код:
C:\Users\Administrator\Desktop\BETA SERVER\gamemodes\PS.pwn(32450) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\BETA SERVER\gamemodes\PS.pwn(32453) : error 017: undefined symbol "TimeConvert"
C:\Users\Administrator\Desktop\BETA SERVER\gamemodes\PS.pwn(32453) : error 033: array must be indexed (variable "ban_expire")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Line :32450   BanExpire = cache_get_value_name(i, "BanExpire");
The script parts.

Код:
public OnBanLoad(playerid) // i think that why it wasnt working x?
{
    new rows = cache_num_rows();
    new string[128], name[24], BannedBy[24], BanReason[24], BanOn[24], BanExpire,
    Mainstring[800], ban_expire[68];

    if(rows)
    {
        for(new i; i < rows; i++)
        {
            cache_get_value_name(i, "PlayerName", name);
            cache_get_value_name(i, "BannedBy", BannedBy);
            cache_get_value_name(i, "BanReason", BanReason);
            cache_get_value_name(i, "BanOn", BanOn);//fixeed How it was ccache iremvoed cok
            BanExpire = cache_get_value_name(i, "BanExpire");

            if(BanExpire == 0) ban_expire = "PERMANENT";
            else ban_expire = TimeConvert(BanExpire);

            format(string, sizeof(string),"%s / %s / %s / %s / %s\n", name, BannedBy, BanReason, BanOn, ban_expire);
            strcat(Mainstring, string);
        }
        ShowPlayerDialog(playerid, DIALOGS+5471, DIALOG_STYLE_LIST, "Banned Players", Mainstring, "Close", "");
    }
    else ShowPlayerDialog(playerid, DIALOGS+5471, DIALOG_STYLE_MSGBOX, "Note", "{FF0000}No banned players found", "Close", "");
    return 1;
}
More

Код:
CMD:bans(playerid, params[])
{
    if(Info[playerid][Level] >= 4)
    {
        mysql_tquery(mysql, "SELECT * FROM `BannedPlayers`", "OnBanLoad", "i", playerid); //why??
        return 1;
    }
    else return ShowMessage(playerid, red, 1);
}
CMD:bplayers(playerid, params[]) return cmd_bans(playerid, params);
Код:
forward OnBanLoad(playerid);
Reply
#2

Your arguments for cache_get_value_name don't match the definition. You're getting the value, but you aren't storing it.
Quote:

(row_idx, const column_name[], destination[], max_len = sizeof(destination))

Since 'ban_expire' is an array, you need to specify the index of which you're storing the time in, i.e. ban_expire[MAX_PLAYERS].

Could you post your TimeConvert stock as well?
Reply
#3

cache_get_value_name
Код:
cache_get_value_name(row_idx, const column_name[], destination[], max_len = sizeof(destination))
So you have to change this line
Код:
BanExpire = cache_get_value_name(i, "BanExpire");
to this..
Код:
cache_get_value_name(i, "BanExpire", BanExpire);
And this
Код:
if(BanExpire == 0) ban_expire = "PERMANENT";
else ban_expire = TimeConvert(BanExpire);
to this..
Код:
if(BanExpire == 0) format(ban_expire, sizeof(ban_expire), "PERMANENT");
else format(ban_expire, sizeof(ban_expire), TimeConvert(BanExpire));
It looks like, you didn't create the function..
Код:
error 017: undefined symbol "TimeConvert"
Reply
#4

This is remaining
Код:
C:\Users\Administrator\Desktop\BETA SERVER\gamemodes\PS.pwn(32576) : error 035: argument type mismatch (argument 3)
C:\Users\Administrator\Desktop\BETA SERVER\gamemodes\PS.pwn(32579) : error 017: undefined symbol "TimeConvert"
Line 32576: cache_get_value_name(i, "BanExpire", BanExpire);

Line 32579: else format(ban_expire, sizeof(ban_expire), TimeConvert(BanExpire));

Should i do
Код:
new TimeConvert
I mean that's only line the TimeConvert is presented.

If i made stock, im not really sure what should i put in it.
Reply
#5

UPDATE: Okay so i got it working but... the TimeConverter is not kinda working xD
http://prntscr.com/muqxef Here is screen.

It doesn't convert the Database date at all. It stays as same as in the database
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)