Mysql.
#1

HI all.I want ask with one thing.It's posibble to do with mysql save director not ID,but that name what he work like: police director.I try do something:

Код:
new Work [ 25 ];
if(PlayerData[playerid][plead] == 1) Work = "Police director";
else if(PlayerData[playerid][plead] == 2) Work = "Medic director";
else if(PlayerData[playerid][plead] == 0) Work = "Nothing";
But i don't know what do with loading,for ex:

how to do when loading if player is police director then this varriable:

Код:
PlayerData[playerid][plead]
SET TO 1,or medic set to 2,or if don't have director then set to 0.
Reply
#2

You can use sscanf.

pawn Код:
new f[ 750 ]; // Big lmao, you may decrease.
if( mysql_fetch_row( f ) ) {
    new dataint[ 5 ]; // Set this to number of integers in your mysql table.
    new datastr[ 5 ][ 200 ]; // Set this to number of strings in your mysql table. You can also change the string size if you don't need 200.
    sscanf(line, "p<|>ds[size]ds[size]", dataint[ 0 ], datastr[ 0 ], etc.); // I suppose you know how to use sscanf. D is integer and S is string, you might also have floats, etc. With string, you need to assign a size. Make sure the sscanf code matches with your mysql table structure.
    PlayerData[ playerid ][ plead ] = dataint[ number ];
    // W/e else you want to load.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)