17.07.2012, 13:51
(
Последний раз редактировалось dholmes7512; 17.07.2012 в 18:34.
)
I am creating a inventory system where you can use /inv use 1, /inv usetool 3 etc. But I got as far as /inv use/usetool. I can't find a way to make it so you can input an integer to use a inventory slot. The code is:
This code probably looks daft as I am not an experienced pawno coder, but I have tried a number of things, including Strval.
So I was wondering if any of you guys could give me a hand here, should I use Strval or sscanf? And how would I go about doing so.
pawn Код:
CMD:inv(playerid, params[])
{
new option[20];
if(isnull(params))
{
return cmd_inventory(playerid, params);
}
if(!strcmp(option, "use", true))
{
new invid;
if(sscanf(params, "i", invid))
{
if (invid == 1)
{
SendClientMessage(playerid, USAGE, "1 Working.");
}
if (invid == 2)
{
SendClientMessage(playerid, USAGE, "2 Working.");
}
}
return 1;
}
if(!strcmp(option, "usetool", true))
{
return 1;
}
return 1;
}
So I was wondering if any of you guys could give me a hand here, should I use Strval or sscanf? And how would I go about doing so.