19.11.2015, 21:09
Hey, so Ive created this small character system (currently supports 1 character only), im only now wondering how to load the character for the player? Ive created MasterID for characters but Ive got no luck to get the player name, or any informations.
Im not any good with SQL, but basically what Im trying to do is:
1. Look for Player name (table characters) thats MasterID is same as AccInfo[playerid][ID]
pawn Код:
mysql_format(mysql, query, sizeof(query), "SELECT `PlayerName` FROM `characters` WHERE `MasterID` = '%d' LIMIT 1", AccInfo[playerid][ID]);
mysql_tquery(mysql, query, "OnCharacterLoad", "i", playerid);
public OnCharacterLoad(playerid)
{
CharInfo[playerid][PlayerName] = cache_get_field_name(0,"PlayerName");
CharInfo[playerid][Age] = cache_get_field_content_int(0, "Age");
CharInfo[playerid][Sex] = cache_get_field_content_int(0, "Sex");
return true;
}
Im not any good with SQL, but basically what Im trying to do is:
1. Look for Player name (table characters) thats MasterID is same as AccInfo[playerid][ID]