ChangeName error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ChangeName error (
/showthread.php?tid=579008)
ChangeName error -
ShoortyFl - 23.06.2015
Something about this is giving me these errors:
pawn Код:
CMD:changename(playerid, params[])
{
if(PI[playerid][Admin] < 6) return SCM(playerid, TOMATO, "[RPF] {FFFFFF}Niste ovlasteni za koristenje ove komande.");
new id, ime[26], query[128];
if(sscanf(params, "us[26]", id, ime)) return SCM(playerid, WHITE, "Koristite: /changename [ID Igraca / Deo Imena] [Novo Ime]");
if(!IsPlayerConnected(id)) return SCM(playerid, TOMATO, "[RPF] {FFFFFF}Taj igrac nije online.");
if(strlen(ime) < 6 || strlen(ime) > 26) return SCM(playerid, TOMATO, "[RPF] {FFFFFF}Ime mora da sadrzi minimalno 6 a maksimalno 26 karaktera.");
format(query, sizeof(query), "SELECT `Ime` FROM `Igraci` WHERE `Ime` = '%s'", ime);
mysql_function_query(konekt, query, true, "ChangeName", "iis", playerid, id, ime);
return 1;
}
pawn Код:
public ChangeName(playerid, id, name[])
{
new szRows, szFields, query[178];
cache_get_data(szRows, szFields);
if(!szRows)
{
if(PI[playerid][Kuca] != -1) strmid(HInfo[PI[id][Kuca]][Vlasnik], name, 0, strlen(name), 255); PostaviKucneLabele(PI[id][Kuca]);
format(query, sizeof(query), "UPDATE `Igraci` SET `Ime` = '%s' WHERE `Ime` = '%s'", name, ImeIgraca(id));
mysql_function_query(konekt, query, true, "OnQueryFinish", "ii", THREAD_OSTALO, id);
format(query, sizeof(query), "UPDATE `Kuce` SET `Vlasnik` = '%s' WHERE `ID` = '%d'", name, PI[id][Kuca]);
mysql_function_query(konekt, query, true, "OnQueryFinish", "ii", THREAD_OSTALO, id);
SCMF(playerid, TOMATO, "[RPF] {FFFFFF}Ime igraca {00C0FF}%s {FFFFFF}je promenjeno u {00C0FF}%s.", ImeIgraca(id), name);
SCMF(id, YELLOW, "[RPF] {FFFFFF}Staff %s vam je promenio ime u %s.", ImeIgraca(playerid), name);
SetPlayerName(id, name);
}
else
{
SCMF(playerid, GREY, "Racun pod imenom '%s' vec postoji.", name);
}
return 1;
}
Errors:
[21:27:58] [debug] Run time error 4: "Array index out of bounds"
[21:27:58] [debug] Accessing element at negative index -1
[21:27:58] [debug] AMX backtrace:
[21:27:58] [debug] #0 000d4f84 in ?? (0xffffffff) from rpfa.amx
[21:27:58] [debug] #1 000d8210 in public ChangeName (0x00000000, 0x00000000, 0x0126ba04) from rpfa.amx
Re: ChangeName error -
ShoortyFl - 23.06.2015
anyone ?
Re: ChangeName error -
ShoortyFl - 24.06.2015
Anyone ?