Pitanje/Savjet:
[22:26:22] sscanf warning: Format specifier does not match parameter count.
[22:26:29] sscanf warning: Format specifier does not match parameter count.
[22:32:17] sscanf warning: Format specifier does not match parameter count.
Izbacuje mi ovo u server.log sta bi moglo da bude?
https://github.com/y-less/sscanf/blob/master/README.md#sscanf-warning-format-specifier-does-not-match-parameter-count
Također "apdejtuj" sscanf.
Citat: armstrongs poslato Septembar 11, 2023, 22:06:19 POSLE PODNE
Pitanje/Savjet:
[22:26:22] sscanf warning: Format specifier does not match parameter count.
[22:26:29] sscanf warning: Format specifier does not match parameter count.
[22:32:17] sscanf warning: Format specifier does not match parameter count.
Izbacuje mi ovo u server.log sta bi moglo da bude?
Nešto mi govori da je problem do parametara kao da neki ne postoji
I također update sscanf kao što je pokerface rekao
Nije do updata sscanfa, nasao sam koji je problem.. Problem je u komandama
Komande su:
/afv - da popravis nekom igracu vozilo
/flipcar - da vratis auto nekom u prvobitno stanje
CMD:flipcar(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
{
new id;
if(sscanf(params, "rs[166]", id)) return KORISTIMES(playerid, "/flipcar [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new Float:A, vehicleid = GetPlayerVehicleID(id);
if(!IsPlayerInAnyVehicle(id)) return GRESKAMES(playerid, "Igrac nije u vozilo");
GetVehicleZAngle(vehicleid, A);
SetVehicleZAngle(vehicleid, A);
INFOMES(playerid, "{FF8C00}[FLIP CAR] | {FFFFFF}Flipovali ste auto igracu.");
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu.");
return 1;
}
CMD:afv(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new id;
if(sscanf(params, "fv", id)) return KORISTIMES(playerid, "/afv [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new string[128];
RepairVehicle(GetPlayerVehicleID(id));
SetVehicleHealth(GetPlayerVehicleID(id), 999.0);
INFOMES(playerid, "Go popravivte voziloto.");
format(string, sizeof(string), "{FF8C00}[FIXVEH] | {FFFFFF} %s[%d] je popravio vozilo igracu %s[%d]", GetName(playerid), playerid, GetName(id), id);
ABroadCast(COLOR_WHITE, string, 1);
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu");
return 1;
}
Aj ko zna neka pogleda i neka kaze u cemu je problem tu
if(sscanf(params, "rs[166]", id))
Šta bi tebi točno trebalo označavati rs[166]?
c - A character.
d, i - An integer.
h, x - A hex number (e.g. a colour).
f - A float.
s - A string.
z - An optional string.
pX - An additional delimiter where X is another character.
'' - Encloses a litteral string to locate.
u - User, takes a name, part of a name or an id and returns the id if they're connected.
U ovom slučaju tebi treba ID/Ime igrača za što koristimo 'u' odnosno:
[pawn]if(sscanf(params, "u", id)) [/pawn]
Ispravljene komande:
[pawn]CMD:flipcar(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/flipcar [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new Float:A, vehicleid = GetPlayerVehicleID(id);
if(!IsPlayerInAnyVehicle(id)) return GRESKAMES(playerid, "Igrac nije u vozilo");
GetVehicleZAngle(vehicleid, A);
SetVehicleZAngle(vehicleid, A);
INFOMES(playerid, "{FF8C00}[FLIP CAR] | {FFFFFF}Flipovali ste auto igracu.");
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu.");
return 1;
}[/pawn]
[pawn]CMD:afv(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/afv [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new string[128];
RepairVehicle(GetPlayerVehicleID(id));
SetVehicleHealth(GetPlayerVehicleID(id), 999.0);
INFOMES(playerid, "Go popravivte voziloto.");
format(string, sizeof(string), "{FF8C00}[FIXVEH] | {FFFFFF} %s[%d] je popravio vozilo igracu %s[%d]", GetName(playerid), playerid, GetName(id), id);
ABroadCast(COLOR_WHITE, string, 1);
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu");
return 1;
}
[/pawn]
Citat: Paul Castellano poslato Septembar 13, 2023, 22:19:18 POSLE PODNE
if(sscanf(params, "rs[166]", id))
Šta bi tebi točno trebalo označavati rs[166]?
c - A character.
d, i - An integer.
h, x - A hex number (e.g. a colour).
f - A float.
s - A string.
z - An optional string.
pX - An additional delimiter where X is another character.
'' - Encloses a litteral string to locate.
u - User, takes a name, part of a name or an id and returns the id if they're connected.
U ovom slučaju tebi treba ID/Ime igrača za što koristimo 'u' odnosno:
[pawn]if(sscanf(params, "u", id)) [/pawn]
Ispravljene komande:
[pawn]CMD:flipcar(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/flipcar [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new Float:A, vehicleid = GetPlayerVehicleID(id);
if(!IsPlayerInAnyVehicle(id)) return GRESKAMES(playerid, "Igrac nije u vozilo");
GetVehicleZAngle(vehicleid, A);
SetVehicleZAngle(vehicleid, A);
INFOMES(playerid, "{FF8C00}[FLIP CAR] | {FFFFFF}Flipovali ste auto igracu.");
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu.");
return 1;
}[/pawn]
[pawn]CMD:afv(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/afv [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new string[128];
RepairVehicle(GetPlayerVehicleID(id));
SetVehicleHealth(GetPlayerVehicleID(id), 999.0);
INFOMES(playerid, "Go popravivte voziloto.");
format(string, sizeof(string), "{FF8C00}[FIXVEH] | {FFFFFF} %s[%d] je popravio vozilo igracu %s[%d]", GetName(playerid), playerid, GetName(id), id);
ABroadCast(COLOR_WHITE, string, 1);
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu");
return 1;
}
[/pawn]
Hvala, probacu sad sa "u" i javim
Citat: Paul Castellano poslato Septembar 13, 2023, 22:19:18 POSLE PODNE
if(sscanf(params, "rs[166]", id))
Šta bi tebi točno trebalo označavati rs[166]?
c - A character.
d, i - An integer.
h, x - A hex number (e.g. a colour).
f - A float.
s - A string.
z - An optional string.
pX - An additional delimiter where X is another character.
'' - Encloses a litteral string to locate.
u - User, takes a name, part of a name or an id and returns the id if they're connected.
U ovom slučaju tebi treba ID/Ime igrača za što koristimo 'u' odnosno:
[pawn]if(sscanf(params, "u", id)) [/pawn]
Ispravljene komande:
[pawn]CMD:flipcar(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/flipcar [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new Float:A, vehicleid = GetPlayerVehicleID(id);
if(!IsPlayerInAnyVehicle(id)) return GRESKAMES(playerid, "Igrac nije u vozilo");
GetVehicleZAngle(vehicleid, A);
SetVehicleZAngle(vehicleid, A);
INFOMES(playerid, "{FF8C00}[FLIP CAR] | {FFFFFF}Flipovali ste auto igracu.");
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu.");
return 1;
}[/pawn]
[pawn]CMD:afv(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return GRESKAMES(playerid, "Ni ste logovani.");
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new id;
if(sscanf(params, "u", id)) return KORISTIMES(playerid, "/afv [ID/Ime na Igraca]");
if(!IsPlayerConnected(id)) return GRESKAMES(playerid, "Igrac nije online.");
new string[128];
RepairVehicle(GetPlayerVehicleID(id));
SetVehicleHealth(GetPlayerVehicleID(id), 999.0);
INFOMES(playerid, "Go popravivte voziloto.");
format(string, sizeof(string), "{FF8C00}[FIXVEH] | {FFFFFF} %s[%d] je popravio vozilo igracu %s[%d]", GetName(playerid), playerid, GetName(id), id);
ABroadCast(COLOR_WHITE, string, 1);
}
else GRESKAMES(playerid, "Ne mozete koristiti tu komandu");
return 1;
}
[/pawn]
Reseno, hvala :)
Citat: Paul Castellano poslato Septembar 13, 2023, 22:19:18 POSLE PODNE
U ovom slučaju tebi treba ID/Ime igrača za što koristimo 'u' odnosno:
"u" se koristi za igrace i botove
"r" se koristi iskljucivo za igrace
"q" se koristi iskljucivo za botove
Ipak, ukoliko ne koristis NPCove nemas potrebe da koristis "r".