SA-MP Forums Archive
warning 203: symbol is never used: "ginklas" - 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: warning 203: symbol is never used: "ginklas" (/showthread.php?tid=498013)



warning 203: symbol is never used: "ginklas" - karolis11234 - 01.03.2014

okay here are the lines:
CMD:ginklas(playerid, params[])
{
new string;
new gunid;
new kulkos;
if(sscanf(params, "i", gunid, kulkos)) SendClientMessage(playerid, COLOR_ORANGE, "Teisingas Naudojimas: /ginklas id");
else if(gunid < 1 || gunid > 46) SendClientMessage(playerid, COLOR_ORANGE, "Tokio Ginklo Nera!"
else if(kulkos < 1) SendClientMessage(playerid, COLOR_ORANGE, "0 Kulku Negali Paimti");
else if(kulkos > 500) SendClientMessage(playerid, COLOR_ORANGE, "Kulku Pasiemino Limitas: 500");
else
{
GivePlayerWeapon(playerid, gunid, kulkos);
format(string,sizeof(string),"Pasiemiai Pasirinkto Ginklo %s Kulku!",kulkos);
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}

}
the error is in the line :new string;
how can i fix that ?


Re: warning 203: symbol is never used: "ginklas" - Clad - 01.03.2014

The symbol ginklas is defined but not used thats all


Re: warning 203: symbol is never used: "ginklas" - karolis11234 - 01.03.2014

but how can i fix it ?


Re: warning 203: symbol is never used: "ginklas" - Clad - 01.03.2014

remove the symbol


Re: warning 203: symbol is never used: "ginklas" - SpartaDM - 01.03.2014

Remove the symbol of ginklas and it's good.


Re: warning 203: symbol is never used: "ginklas" - Clad - 01.03.2014

Quote:
Originally Posted by SpartaDM
Посмотреть сообщение
Remove the symbol of ginklas and it's good.
It's just what I said, I don't know why you replyed to say the same thing


Re: warning 203: symbol is never used: "ginklas" - karolis11234 - 01.03.2014

do i have to delete the command?


Re: warning 203: symbol is never used: "ginklas" - Konstantinos - 01.03.2014

Read the code before posting random things. ginklas is used as the name of the command which means zcmd is not included:
pawn Код:
#include <a_samp>
#include <zcmd>
There's nothing to remove..

There're also few more things:
- string should be an array/string, not an integer.
- sscanf has 1 specifier "i" but 2 arguments (gunid, kulkos).
- you forgot ");" at the end of a client message, you try to display an integer to a text using %s placeholder which is for strings so you'll need to get the weapon's name.

pawn Код:
CMD:ginklas(playerid, params[])
{
    new gunid, kulkos;
    if (sscanf(params, "ii", gunid, kulkos)) return SendClientMessage(playerid, COLOR_ORANGE, "Teisingas Naudojimas: /ginklas <id> <ammo>");
    if(gunid < 1 || gunid > 46) return SendClientMessage(playerid, COLOR_ORANGE, "Tokio Ginklo Nera!");
    if(kulkos < 1 || kulkos > 500) return SendClientMessage(playerid, COLOR_ORANGE, "Limit: 0-500");
    GivePlayerWeapon(playerid, gunid, kulkos);
    new string[128];
    GetWeaponName(gunid, string, 32);
    format(string,sizeof(string),"Pasiemiai Pasirinkto Ginklo %s Kulku!",string);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}