Problem with split - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with split (
/showthread.php?tid=268439)
Problem with split -
[IL]HeHu - 12.07.2011
Hey, this is the split function to those unfamiliar with it:
PHP код:
public split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
Now I tried to do this:
PHP код:
new Parts[3][52];
split(mysql_Float(SQL_USERS,PlayerInfo[playerid][pUID],"spawn"), Parts, ',');
And this is the error it puts out:
PHP код:
C:\Users\Mark\Desktop\GRP.pwn(350) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: Problem with split -
[IL]HeHu - 12.07.2011
Cause I am not quite comfortable with using sscanf, I don't know why really. I'll try and look through it again though, thanks.
Re: Problem with split -
[IL]HeHu - 12.07.2011
Did it with sscanf:
PHP код:
sscanf(mysql_Int(SQL_USERS,PlayerInfo[playerid][pUID],"spawn"),"p<,>fff", PlayerInfo[playerid][pSpawn][0], PlayerInfo[playerid][pSpawn][1],PlayerInfo[playerid][pSpawn][2]);
Still writes the same error, here is mysql_Int:
PHP код:
stock mysql_Get(table[],id,key[])
{
new string[128];
format(string, sizeof(string), "SELECT `%s` FROM `%s` WHERE `id` = '%d'",key,table,id);
mysql_query(string);
mysql_store_result();
mysql_fetch_row_format(string);
return string;
}
mysql_int is just calling mysql_Get and converting it into integers.