Doubt with Mysql and Samp -
OdgFox - 14.05.2020
Hello, I would like to know how I can take 2 values from the same field, for example, it looks like this in my database:
V_KEY_1
1,2
V_Key_1 is the name of the column,
1 is the sqlid of the vehicle
2 is the type of the key (1 for owners and 2 for friends)
...
My question is how i can get 1 and 2 per separate in the same code..

їCan you help me? Thanks!
Re: Doubt with Mysql and Samp -
Shaheen - 14.05.2020
You can make use of sscanf to achieve this.
PHP Code:
if(sscanf(params, "p<,>fff", x, y, z))
{
Usage(playerid, "teleport <x, y, z>");
}
here is an example,
it just tells to separately enter x y and z with commas between them,
if you show the code i can provide you with more details... (Maybe)
Re: Doubt with Mysql and Samp -
Kwarde - 14.05.2020
Here is more information on how to use sscanf:
https://sampforum.blast.hk/showthread.php?tid=570927
Re: Doubt with Mysql and Samp -
OdgFox - 14.05.2020
Thanks for your time, i want to make some like this
Code
Code:
new newload[10][32];
explode("This,is,a,string",",",newload);
printf("%s-%s-%s-%s",newload[0],newload[1],newload[2],newload[3]);
That code show
їI can do with sscanf too?
I take that code from
https://sampforum.blast.hk/showthread.php?tid=223561 but is very old and i don't want add that on my GM.
Re: Doubt with Mysql and Samp -
Kwarde - 14.05.2020
Even though your code wouldn't compile, yes:
pawn Code:
new newload[10][32];
newload[0] = "This,is,a,string";
sscanf(newload[0], "p<,>s[32]s[32]s[32]s[32]", newload[0], newload[1], newload[2], newload[3]);
printf("%s-%s-%s-%s", newload[0], newload[1], newload[2], newload[3]);
Once again, I refer to that URL I sent, it explains very well how sscanf works.
Re: Doubt with Mysql and Samp -
OdgFox - 14.05.2020
Thanks for your help ♥