SA-MP Forums Archive
Command - 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: Command (/showthread.php?tid=518762)



Command - Lajko1 - 11.06.2014

Hello this time I encountered to problem after long time :P

I'm working on /selldrugs command for Roleplay server, It was working at start but now there is a problem I can't solve.

Here is the part of code where the problem is, I will describe problem below it.

pawn Код:
needed = strval(tmp);
price = strval(tmp);


if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}/selldrugs (/sd) [playerid] [drugname] [amount] [price]");
            SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}Please insert player's ID");
            return 1;
        }
        if(!strlen(x_nr))
        {
            SendClientMessage(playerid, -1, "{FF6A22}USAGE: {FFFFFF}/selldrugs (/sd) [playerid] [drugname] [amount] [price]");
            SendClientMessage(playerid, -1, "{FF6A22}Available names: {FFFFFF}Weed, Cocaine, Crack, Meth, Ectasy, Heroin");
            return 1;
        }
        if(needed < 1 || needed > 99)
        {
            SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF}You can't go below 1 or above 99 grams");
            return 1;
        }
        if(price < 1 || price > 9999)
        {
            SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF}You can't go below $1 or above $9999");
            return 1;
        }
Okay so the problem is whenever I write /selldrugs (playerid) (drugname)... it will send me this msgs:
pawn Код:
if(!strlen(x_nr))
        {
            SendClientMessage(playerid, -1, "{FF6A22}USAGE: {FFFFFF}/selldrugs (/sd) [playerid] [drugname] [amount] [price]");
            SendClientMessage(playerid, -1, "{FF6A22}Available names: {FFFFFF}Weed, Cocaine, Crack, Meth, Ectasy, Heroin");
            return 1;
        }
and If I will write "/selldrugs (playerid) weed"

it will send me this msg:

pawn Код:
if(needed < 1 || needed > 99)
        {
            SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF}You can't go below 1 or above 99 grams");
            return 1;
        }
Command is only for test now when I will fix that problem I will make fresh full command, thanks for help ^^

Oh I'm using oldschool way of scripting cmds I'm used on it and server is supporting only strcmp..


Re: Command - RenovanZ - 11.06.2014

Why dont you use sscanf2 ? Its more easier.


Re: Command - Lajko1 - 11.06.2014

Well strcmp it's easier for me... So I will need some help with this now if you don't mind