08.01.2010, 09:05
Hello,
Can someone help me on this: (I've searched forums, already)
- I would like to set variables in the samp script with values which will be fetched from my mysql database.
Now the thing is, I don't know how to do it. I have some gamemodes with mysql who do it in a different way, but I don't understand their method, the way things are done.
Example
So that's what I want to do. Now this is what I've found:
Can someone explain to me what
exactly does? And what is the purpose of strtok here? I searched strtok on wiki, but its very poorly explained as in what exactly everything is doing. Can't find any explanation of that index parameter. I'm not someone who wants to copy stuff from other scripts. I want to grasp and understand what is going on in the code..
Thanks.
Can someone help me on this: (I've searched forums, already)
- I would like to set variables in the samp script with values which will be fetched from my mysql database.
Now the thing is, I don't know how to do it. I have some gamemodes with mysql who do it in a different way, but I don't understand their method, the way things are done.
Example
Код:
PlayerInfo[playerid][Level] = "mysql value here"
Код:
SendQuery(szQuery); mysql_store_result(); if (!mysql_num_rows()) return SendNSMessage(playerid, COLOR_RED, "The password you supplied is invalid."); new index, line[256]; mysql_fetch_row_format(line, "|"); PlayerInfo[playerid][LoggedIn] = true; PlayerInfo[playerid][UserID] = strval(strtok(line, index, '|')); PlayerInfo[playerid][Level] = strval(strtok(line, index, '|')); PlayerInfo[playerid][Kills] = strval(strtok(line, index, '|')); //some queries here mysql_free_result();
Код:
mysql_fetch_row_format()
Thanks.