First time I see this error.... [Run time error 6: "Invalid instruction"]
#1

ĖRROR LINES:
pawn Code:
[05:59:21] [debug] Run time error 6: "Invalid instruction"
[05:59:21] [debug]  Unknown opcode 0x0 at address 0x00000004
[05:59:21] [debug] AMX backtrace:
[05:59:21] [debug] #0 00000004 in public OnLoginAttempt () at Server\samp03z_svr_R1_win32\pawno\include\float.inc:108
CODE:
pawn Code:
public OnLoginAttempt(playerid) {
    new rows,fields;
    cache_get_data(rows,fields);
    new loginattempts = GetPVarInt(playerid,"LoginAttempts");
    new msg[128];
    if(rows < 1) {
        loginattempts++;
        if((MAX_LOGIN_ATTEMPTS-loginattempts) <= 0) {
            SendClientMessage(playerid, X11_RED,"You have been kicked for entering the incorrect password.");
            Kick(playerid);
        }
        SetPVarInt(playerid,"LoginAttempts",loginattempts);
        format(msg,sizeof(msg),"[ERROR]: Incorrect password. You have %d more attempts before you will be kicked.",MAX_LOGIN_ATTEMPTS-loginattempts);
        SendClientMessage(playerid, X11_WHITE, msg);
        ShowLoginDialog(playerid);
        return 1;
    }
    SendClientMessage(playerid, X11_ORANGE,"Successful login!");
    new alevel, id_string[32];
    cache_get_row(0,0,id_string);
    //`adminlevel`,`newbrank`,`connecttime`,`admintitle`
    alevel = strval(id_string);
    cache_get_row(0,1,id_string);
    SetPVarInt(playerid, "NewbieRank", strval(id_string));
    cache_get_row(0,2,id_string);
    SetPVarInt(playerid, "ConnectTime", strval(id_string));
    cache_get_row(0,3,id_string);
    SetPVarString(playerid, "AdminTitle", id_string);
    if(alevel != 0) {
        format(msg,sizeof(msg),"You are logged in as a %s!",id_string);
        SendClientMessage(playerid, X11_WHITE, msg);
        SetPVarInt(playerid,"AdminFlags",alevel);
    }
    cache_get_row(0,1,id_string);
    alevel = strval(id_string);
    if(alevel != 0) {
        SetPVarInt(playerid,"NewbieRank",alevel);
        format(msg,sizeof(msg),"You are logged in as a %s",GetNewbieName(playerid));
        SendClientMessage(playerid, X11_WHITE, msg);
    }
    if(GetPVarInt(playerid, "AdminFlags") != 0 || GetPVarInt(playerid, "NewbieRank") != 0) {
        adminOnPlayerLogin(playerid);
    }
    cache_get_row(0,4,id_string); //donate points
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonatePoints", alevel);
   
    cache_get_row(0,5,id_string); //donate rank
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonateRank", alevel);
   
    cache_get_row(0,6,id_string); //cookies
    alevel = strval(id_string);
    SetPVarInt(playerid, "Cookies", alevel);
   
    cache_get_row(0,7,id_string); //ajail release time
    alevel = strval(id_string);
    if(alevel > 0) {
        SetTimerEx("AJail",1000, false, "dds", playerid, alevel, "AJailed");
    }
   
    cache_get_row(0,8,id_string);
    SetPVarInt(playerid, "NMuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,9,id_string);
    SetPVarInt(playerid, "MuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,10,id_string);
    SetPVarInt(playerid, "ReportBanned", strval(id_string));
   
    cache_get_row(0,11,id_string);
    SetPVarInt(playerid, "AccountFlags", strval(id_string));

    cache_get_row(0,12,id_string);
    SetPVarInt(playerid, "NumAJails", strval(id_string));
   
    cache_get_row(0,13,id_string);
    SetPVarInt(playerid, "NumKicks", strval(id_string));
   
    cache_get_row(0,14,id_string);
    SetPVarInt(playerid, "NumBans", strval(id_string));
   
    cache_get_row(0,15,id_string);
    new hideval = strval(id_string);
    if(hideval != 0)
        SetPVarInt(playerid, "AdminHidden", hideval);
   
    OnPlayerLogin(playerid);
    return 1;
}
It started when I added this dialog:
pawn Code:
SendStats(playerid,targetid)
{
    new showall[1028];
    new msg[126];
    new spousename[MAX_PLAYER_NAME+1];
    GetPVarString(targetid, "SpouseName", spousename, sizeof(spousename));
    format(msg,sizeof(msg),"Level:[%s] Sex:[%s] Cash:[$%s] Bank:[$%s] Spouse:[%s]\n",getNumberString(GetPVarInt(targetid,"Level")),GetSexName(GetPVarInt(targetid,"Sex")),getNumberString(GetPVarInt(targetid,"Money")),getNumberString(GetPVarInt(targetid,"Bank")),spousename);
    strcat(showall,msg);
    format(msg,sizeof(msg),"DonateRank:[%s] Donate Points:[%s] Phone:[%d] LottoNr:[%d] Job:[%s] WTChan:[%d] FurnitureTokens:[%d]\n",GetDonateRank(GetPVarInt(targetid,"DonateRank")),getNumberString(GetPVarInt(targetid,"DonatePoints")),GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")),GetPVarInt(targetid, "WTChannel"),GetPVarInt(targetid, "FurnitureTokens"));
    strcat(showall,msg);
    format(msg,sizeof(msg),"WantedLevel:[%d] TimesArrested:[%s] FightStyle:[%s]\n",GetPlayerWantedLevel(playerid),getNumberString(GetPVarInt(targetid,"TimesArrested")),GetFightStyle(GetPVarInt(targetid, "FightStyle")));
    strcat(showall,msg);
    new nextlevel = (GetPVarInt(targetid,"Level")+1);
    new nextlevelcost = nextlevel*levelcost;
    new expamount = nextlevel*levelexp;
    format(msg,sizeof(msg),"NextLevel:[$%s] Respect:[%s/%s] SpecialItem:[%s] Hunger:[%d]\n",getNumberString(nextlevelcost),getNumberString(GetPVarInt(targetid,"RespectPoints")),getNumberString(expamount),GetPlayerCarryingItemName(targetid),GetHungerLevel(targetid));
    strcat(showall,msg);
    format(msg,sizeof(msg),"Cigars:[%s] LockPicks:[%s]\n",getNumberString(GetPVarInt(targetid, "Cigars")),getNumberString(GetPVarInt(targetid, "VehLockpicks")));
    strcat(showall,msg);
    format(msg,sizeof(msg),"Pot:[%s Gram] Coke:[%s Gram] Meth:[%s Gram]\n",getNumberString(GetPVarInt(targetid, "Pot")),getNumberString(GetPVarInt(targetid, "Coke")),getNumberString(GetPVarInt(targetid, "Meth")));
    strcat(showall,msg);
    format(msg,sizeof(msg),"Type A:[%s Packs] Type B:[%s Packs] Type C:[%s Packs]\n",getNumberString(GetPVarInt(targetid, "MatsA")),getNumberString(GetPVarInt(targetid, "MatsB")),getNumberString(GetPVarInt(targetid, "MatsC")));
    strcat(showall,msg);
    new fid = GetPVarInt(targetid,"Family");
    if(fid != 0) {
        fid = FindFamilyBySQLID(fid);
    } else fid = -1;
    if(fid == -1 && GetPVarInt(targetid, "Faction") != 0) {
        fid = GetPVarInt(targetid, "Faction");
        format(msg,sizeof(msg),"Faction:[%s] Rank:[%s]\n",GetFactionName(fid),getFactionRankName(fid,GetPVarInt(targetid, "Rank")));
        strcat(showall,msg);

    } else if(fid != -1) {
        format(msg,sizeof(msg),"Family:[%s] Rank:[%s]\n",GetFamilyName(fid),getRankName(fid,GetPVarInt(targetid, "Rank")));
        strcat(showall,msg);
    }
    format(msg,sizeof(msg),"PlayingHours:[%s] NewbChat Rank:[%s] Cookies:[%s]\n",getNumberString(GetPVarInt(targetid,"ConnectTime")),GetNewbieName(targetid),getNumberString(GetPVarInt(targetid,"Cookies")));
    strcat(showall,msg);

    new matpacks[3], drugpacks[3];
    matpacks[0] = GetPVarInt(playerid, "MatAPacks");
    matpacks[1] = GetPVarInt(playerid, "MatBPacks");
    matpacks[2] = GetPVarInt(playerid, "MatCPacks");
    drugpacks[0] = GetPVarInt(playerid, "PotSeeds");
    drugpacks[1] = GetPVarInt(playerid, "CokePlants");
    drugpacks[2] = GetPVarInt(playerid, "MethMaterials");
    if(matpacks[0] != 0 || matpacks[1] != 0 || matpacks[2] != 0) {
        format(msg,sizeof(msg),"MatAPacks:[%s] MatBPacks:[%s] MatCPacks:[%s]\n",getNumberString(matpacks[0]),getNumberString(matpacks[1]),getNumberString(matpacks[2]));
        strcat(showall,msg);
    }

    if(drugpacks[0] != 0 || drugpacks[1] != 0 || drugpacks[2] != 0) {
        format(msg,sizeof(msg),"PotSeeds:[%s] CokePlants:[%s] MethMaterials:[%s]\n",getNumberString(drugpacks[0]),getNumberString(drugpacks[1]),getNumberString(drugpacks[2]));
        strcat(showall,msg);
    }

    new jailtime = GetPVarInt(targetid, "ReleaseTime");
    new isajail;
    if(jailtime == 0) {
        jailtime = GetPVarInt(targetid, "AJailReleaseTime");
        isajail = 1;
    }
    jailtime -= gettime();
    if(jailtime > 0) {
        format(msg, sizeof(msg), "Jail Time Left: %s sec\n", getNumberString(jailtime));
        strcat(showall,msg);
    }
    if(EAdminFlags:GetPVarInt(playerid, "AdminFlags") != EAdminFlags_None) {
        format(msg, sizeof(msg), "NumAJails:[%s] NumKicks:[%s] NumBans[%s] Wealth:[%s]\n",getNumberString(GetPVarInt(targetid, "NumAJAils")),getNumberString(GetPVarInt(targetid, "NumKicks")), getNumberString(GetPVarInt(targetid, "NumBans")),getNumberString(getTotalWealth(targetid)));
        strcat(showall,msg);
    }
    ShowPlayerDialog(playerid,1337,DIALOG_STYLE_MSGBOX,"Stats",showall,"Okay","");
}
Reply
#2

Try this one :-
pawn Code:
public OnLoginAttempt(playerid) {
    new rows,fields;
    cache_get_data(rows,fields);
    new loginattempts = GetPVarInt(playerid,"LoginAttempts");
    new msg[128];
    if(rows < 1) {
        loginattempts++;
        if((MAX_LOGIN_ATTEMPTS-loginattempts) <= 0) {
            SendClientMessage(playerid, X11_RED,"You have been kicked for entering the incorrect password.");
            Kick(playerid);
        }
        SetPVarInt(playerid,"LoginAttempts",loginattempts);
        format(msg,sizeof(msg),"[ERROR]: Incorrect password. You have %d more attempts before you will be kicked.",MAX_LOGIN_ATTEMPTS-loginattempts);
        SendClientMessage(playerid, X11_WHITE, msg);
        ShowLoginDialog(playerid);
        return 1;
    }
    SendClientMessage(playerid, X11_ORANGE,"Successful login!");
    new alevel, id_string[32];
    cache_get_row(0,0,id_string);
    //`adminlevel`,`newbrank`,`connecttime`,`admintitle`
    alevel = strval(id_string);
    cache_get_row(0,1,id_string);
    SetPVarInt(playerid, "NewbieRank", strval(id_string));
    cache_get_row(0,2,id_string);
    SetPVarInt(playerid, "ConnectTime", strval(id_string));
    cache_get_row(0,3,id_string);
    SetPVarString(playerid, "AdminTitle", id_string);
    if(alevel != 0) {
        format(msg,sizeof(msg),"You are logged in as a %s!",id_string);
        SendClientMessage(playerid, X11_WHITE, msg);
        SetPVarInt(playerid,"AdminFlags",alevel);
    }
    cache_get_row(0,1,id_string);
    alevel = strval(id_string);
    if(alevel != 0) {
        SetPVarInt(playerid,"NewbieRank",alevel);
        format(msg,sizeof(msg),"You are logged in as a %s",GetNewbieName(playerid));
        SendClientMessage(playerid, X11_WHITE, msg);
    }
    if(GetPVarInt(playerid, "AdminFlags") != 0 || GetPVarInt(playerid, "NewbieRank") != 0) {
        adminOnPlayerLogin(playerid);
    }
    cache_get_row(0,4,id_string); //donate points
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonatePoints", alevel);
   
    cache_get_row(0,5,id_string); //donate rank
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonateRank", alevel);
   
    cache_get_row(0,6,id_string); //cookies
    alevel = strval(id_string);
    SetPVarInt(playerid, "Cookies", alevel);
   
    cache_get_row(0,7,id_string); //ajail release time
    alevel = strval(id_string);
    if(alevel > 0) {
        SetTimerEx("AJail",1000, false, "dds", playerid, alevel, "AJailed");
    }
   
    cache_get_row(0,8,id_string);
    SetPVarInt(playerid, "NMuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,9,id_string);
    SetPVarInt(playerid, "MuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,10,id_string);
    SetPVarInt(playerid, "ReportBanned", strval(id_string));
   
    cache_get_row(0,11,id_string);
    SetPVarInt(playerid, "AccountFlags", strval(id_string));

    cache_get_row(0,12,id_string);
    SetPVarInt(playerid, "NumAJails", strval(id_string));
   
    cache_get_row(0,13,id_string);
    SetPVarInt(playerid, "NumKicks", strval(id_string));
   
    cache_get_row(0,14,id_string);
    SetPVarInt(playerid, "NumBans", strval(id_string));
   
    cache_get_row(0,15,id_string);
    new hideval = strval(id_string);
    if(hideval != 0) {
        SetPVarInt(playerid, "AdminHidden", hideval);
    }
   
    OnPlayerLogin(playerid);
    return 1;
}
Reply
#3

Still the same.. Problem is still up!
Reply
#4

I know 24 h ain't pass but please help me out!
Reply
#5

Try to compile your script with -d3 compiler it will help us finding the exact line caused this error!

EDIT: By the way i don't think you have problems with your stats stock, as the debug saying there's something wrong with OnLoginAttempt.
Reply
#6

Btw I'm doing it with -d3! But anyways thanks for your answer.
Reply
#7

In an unmodified version of float.inc, at line 108 you can find the function of switching a float number to either the negative (if positive) or positive (if negative) side. Although in your scripts you posted, you haven't used anything related to float numbers. So are you sure the problem is in this part of the code?

But it might also be related to a function which expects a certain type of variable (like an integer, float, string, or array), but it gets another type without expecting it. For example, trying to put a string into a single integer variable. If the first suggestion isn't the case, I believe this second suggestion is what is happening. Then it's just digging through your code and trying to find where the exact problem is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)