05.07.2013, 22:13
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;
}