Command Problem - 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 Problem (
/showthread.php?tid=325967)
Command Problem -
Dripac - 15.03.2012
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
Re: Command Problem -
Prumpuz - 15.03.2012
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.
Re: Command Problem -
Dripac - 15.03.2012
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 =/
AW: Command Problem -
Blunt P - 16.03.2012
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);
Re: AW: Command Problem -
Dripac - 16.03.2012
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