string in SetPlayerPos.
#10

Try this:
pawn Код:
new position[30];
position = "13424.0,35892.0,43647.0";
//NO SPACES BETWEEN FLOATS, JUST USE COMMA


strtokv(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ','))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ',') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}


stock SetPlayerPosFromString(playerid,strpos[256])
{
new Float:x, Float:y, Float:z;
new idx;
x=floatstr(strtokv(strpos,idx));
y=floatstr(strtokv(strpos,idx));
z=floatstr(strtokv(strpos,idx));
SetPlayerPos(playerid,x,y,z);
return 1;
}
Reply


Messages In This Thread
string in SetPlayerPos. - by Activest - 04.07.2013, 21:06
Re: string in SetPlayerPos. - by Akira297 - 04.07.2013, 21:11
Re: string in SetPlayerPos. - by thimo - 04.07.2013, 21:14
Re: string in SetPlayerPos. - by Activest - 04.07.2013, 21:16
Re: string in SetPlayerPos. - by MP2 - 04.07.2013, 21:18
Re: string in SetPlayerPos. - by Activest - 04.07.2013, 21:23
Re: string in SetPlayerPos. - by MP2 - 04.07.2013, 21:46
Re: string in SetPlayerPos. - by Activest - 04.07.2013, 21:47
Re: string in SetPlayerPos. - by MP2 - 04.07.2013, 23:59
Re: string in SetPlayerPos. - by stokdam - 05.07.2013, 22:13

Forum Jump:


Users browsing this thread: 1 Guest(s)