Command Problem
#1

pawn Код:
if(strcmp(cmd, "/createfwall", true) == 0)
    {
        new rand,loop,Float:pX,Float:pY,Float:pZ,str[70];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "Verwendung: /createfwall [Loop Number]");
            return 1;
        }
        else
        {
            if(loop < 1) return SendClientMessage(playerid,COLOR_GREY,"Loop number can't be 0 or lower than 0!");
            GetPlayerPos(playerid,pX,pY,pZ);
            pX = pX + 1.000000;//offset X
            pZ = pZ - 0.800000;//offset Z
            for(new i = 0; i < 16; i++)
            {
                if(i != 4 && i != 8 && i != 12) pX = pX + 4.00;
                else
                {
                    pX = pX - 12.00;
                    pY = pY + 4.00;
                }
                rand = random(20) + 25;
                CreateFirework(FireworkCount,pX,pY,pZ,rand,loop);
                FireworkCount ++;
            }
            format(str,sizeof(str),"There are %d fireworks total!",FireworkCount);
            SendClientMessage(playerid,COLOR_WHITE,string);
        }
        return 1;
    }
Everytime when i type /createfwall 1, or any number, it show's me this message:

pawn Код:
Loop number can't be 0 or lower than 0!
I missed something, but can't see what
Reply
#2

pawn Код:
if(loop < 1) return SendClientMessage(playerid,COLOR_GREY,"Loop number can't be 0 or lower than 0!");
You create "loop" before that, but you don't seem to set it to anything. So when you create it, it's 0.
Reply
#3

Quote:
Originally Posted by Prumpuz
Посмотреть сообщение
pawn Код:
if(loop < 1) return SendClientMessage(playerid,COLOR_GREY,"Loop number can't be 0 or lower than 0!");
You create "loop" before that, but you don't seem to set it to anything. So when you create it, it's 0.
I changed the loop one to if(!strlen(tmp)), but now i can also use number 0 =/
Reply
#4

i think you didnt understand prumpuz ^^

You did not assign any value to your "loop", thats why it wont work. You should have this in your command aswell:
PHP код:
loop strval(tmp); 
Reply
#5

Quote:
Originally Posted by Blunt P
Посмотреть сообщение
i think you didnt understand prumpuz ^^

You did not assign any value to your "loop", thats why it wont work. You should have this in your command aswell:
PHP код:
loop strval(tmp); 
Thanks, i'll try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)