Skripta:MojMod od 0
Opis Problema:Kad sam ubacivao da mi u MySQL da mi sprema admin i GM level dobio sam errore
Dio Skripte:if(dialogid == 15000)
{
if(response)
{
new Query[200], Pname[24];
GetPlayerName(playerid, Pname, 24);
new escpname[24];
mysql_real_escape_string(Pname, escpname);
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = '%s'", escpname, inputtext);
mysql_query(Query);
mysql_store_result();
if(!mysql_num_rows())
{
SendClientMessage(playerid, 0xF60000AA, "Invalid password!");
SetPVarInt(playerid, "WrongPass", GetPVarInt(playerid, "WrongPass") + 1);
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
if(GetPVarInt(playerid, "WrongPass") == 3)
{
SendClientMessage(playerid, 0xF60000AA, "Max password tries exceeded!!");
Kick(playerid);
}
}
else
{
new line[750]; //I know it's big D=
if(mysql_fetch_row(line)) //Fetches the line
{
new data[3][50]; //The data strings
new data2[4]; //The data variables
sscanf(line, "p|ssdddds", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data[2], data[3], data[4]); // linija 268
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); //Sets players score
SetPVarInt(playerid, "MoneyGiven", data2[3]); //Sets players cash
SetPVarInt(playerid, "Admin", data[3]); //linija 274
SetPVarInt(playerid, "GameMaster", data[4]); //linija 275
SendClientMessage(playerid, 0x0000D9AA, "Prijavljen!");
mysql_free_result();
}
}
}
}
return 1;
}
Errori...
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\MojMod.pwn(268) : error 032: array index out of bounds (variable "data")
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\MojMod.pwn(274) : error 032: array index out of bounds (variable "data")
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\MojMod.pwn(275) : error 032: array index out of bounds (variable "data")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
linije?
Stavi umjesto new data[3][50]; //The data strings
ovo:
new data[10][50]; //The data strings
Sad su samo ove dvije zadnje linije a errori su
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\MojMod.pwn(274) : error 035: argument type mismatch (argument 3)
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\MojMod.pwn(275) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
imas tut u pdf tutoriali za taj warn pa sam rjesi!
Citaj malo,to je Error
daj te linije
to je isto sto i number of arguments does not match the definition, da ima eng.bar 3 znao bi sto znaci
Argument Type Missmatch
To je fulio deklaraciju, tj. stavio je npr. float vrijednost gdje treba integer i sl.
i sada daj kod da vidim sta je :S
Dobro postaj te linije an kojem ti izbaci to.
RIJESIO MOZE LOCK
Koristio sam string umjesto varijable
evo ti rijeseno:
sscanf(line, "p<|>dddddd", data[0], data[1], data[2], data[3], data[4], data[5]); // linija 268
SetPVarInt(playerid, "Kills", data[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data[1]); //Sets Pvar ints
SetPlayerScore(playerid, data[2]); //Sets players score
SetPVarInt(playerid, "MoneyGiven", data[3]); //Sets players cash
SetPVarInt(playerid, "Admin", data[4]); //linija 274
SetPVarInt(playerid, "GameMaster", data[5]); //linija 275