14.01.2016, 06:59
Hello!
I've started learning sscanf recently after a long time of painful strtok usage and I've realized that sscanf is SO much easier, I've been missing out.
Anyway, I am trying to make a simple /goto command. I've already written the command and it works fine.
The question is, is it possible to make it read the coords entry with commas?
Because for this command to works, it needs to be in such format:
Is it possible to make it like this aswell?
Thanks!
I've started learning sscanf recently after a long time of painful strtok usage and I've realized that sscanf is SO much easier, I've been missing out.
Anyway, I am trying to make a simple /goto command. I've already written the command and it works fine.
Код:
CMD:goto(playerid, params[]) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] >= 2) { new Float:X, Float:Y, Float:Z, string[128]; if(sscanf(params, "fff", X, Y, Z)) return SCM(playerid, -1, "USAGE: /goto [X] [Y] [Z]"); SetPlayerPos(playerid, X, Y, Z); format(string, sizeof(string), "You have teleported to the follow coordinates: %f, %f, %f.", X, Y, Z); SCM(playerid, -1, string); return 1; } } return 1; }
Because for this command to works, it needs to be in such format:
Код:
/goto 0.00 0.00 0.00
Код:
/goto 0.00, 0.00, 0.00