ZCMD - Help
#1

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?
Reply
#2

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;
}
Reply
#3

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...
Reply
#4

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.
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)