Set 3 Variables w/ one entry
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
I believe you could use sscanf to split the entry by using comma as the delimiter.

pawn Код:
public OnPlayerText(playerid, text[]) {
    new
        Float: fCoordinates[3];

    if(sscanf(text, "p<,>fff", fCoordinates[0], fCoordinates[1], fCoordinates[2]))
        return 1; // Error: Invalid coordinates

    SetPlayerPos(playerid, fCoordinates[0], fCoordinates[1], fCoordinates[2]);
    return 1;
}
However, the spaces should be removed between the coordinate text. (140.17,1366.07,1083.65)
Brilliant, thank you. I didn't even think to use sscanf.
Reply


Messages In This Thread
Set 3 Variables w/ one entry - by austin070 - 20.04.2014, 13:06
Re: Set 3 Variables w/ one entry - by klimgorilla - 20.04.2014, 13:20
Re: Set 3 Variables w/ one entry - by austin070 - 20.04.2014, 13:24
Re: Set 3 Variables w/ one entry - by Calgon - 20.04.2014, 13:34
Re: Set 3 Variables w/ one entry - by austin070 - 20.04.2014, 13:45

Forum Jump:


Users browsing this thread: 1 Guest(s)