ZCMD - Help - 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: ZCMD - Help (
/showthread.php?tid=546635)
ZCMD - Help -
NickHaudMTA - 16.11.2014
Here's the command:
pawn Код:
CMD:West(playerid, params[])
{
if(sscanf(params, "f", West)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /west [Amount].");
format(String, sizeof(String), "You went west for: %.1f).", West);
SendClientMessage(playerid, 0x33AA33FF, String);
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X-West, Y, Z);
return 1;
}
What is the problem? The screen crashes and says "Stay within the world boundaries".
I don't know what's the problem... When I change the format to "u" it works, but, I want the ability to move like this: 0.1, 0.2, 0.3, etc...
Can You help?
Re: ZCMD - Help -
HY - 16.11.2014
pawn Код:
CMD:West(playerid, params[])
{
if(sscanf(params, "i", West)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /west [Amount].");
format(String, sizeof(String), "You went west for: %.1f).", West);
SendClientMessage(playerid, 0x33AA33FF, String);
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X-West, Y, Z);
return 1;
}
Re: ZCMD - Help -
NickHaudMTA - 16.11.2014
Thanks for replying...
But this isn't working, as it has to be a float.
I just don't have any idea why this isn't working...
Re: ZCMD - Help -
Shaneisace - 16.11.2014
Pretty sure you just need to define the "west" as a float like this:
Код:
CMD:west(playerid, params[])
{
new Float: West, Float: Pos[3], String[52];
if(sscanf(params, "f", West)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /west [Amount].");
format(String, sizeof(String), "You went west for: %.1f).", West);
SendClientMessage(playerid, 0x33AA33FF, String);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0]-West, Pos[1], Pos[2]);
return 1;
}
EDIT: i have corrected the code and tested it and it works fine.
Re: ZCMD - Help -
NickHaudMTA - 16.11.2014
Mate! It really works! I'm so greatful, thank You so freaking much, i love You!
Now I can finally continue with my work...
will add rep!