20.01.2015, 21:18
(
Last edited by vassilis; 27/01/2015 at 04:06 AM.
)
solved
pinfo[playerid][skin] = //skinid ;
OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid)); //We open the file "I don't know in mysql"
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid)); //write in the file "In the database" in the skin colmun the last skin that the player was in it
INI_Close(File);
return 1;
}
OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, pinfo[playerid][skin];
return 1;
}
I don't know working with mysql but in y_ini you make this
When the player choose the skin do PHP Code:
PHP Code:
PHP Code:
|
case dialog_login:
{
if( response )
{
new pPass[ 20 ];
if( sscanf( inputtext, "s[20]", pPass ) )
{
SendClientMessage(playerid,-1,""COL_RED"CCNR SYSTEM"COL_WHITE": Our system requires to "COL_GREEN"login"COL_WHITE"to continue.");
Kick(playerid);
return 1;
}
OnPlayerLogin2( playerid, pPass );
if(recentlyregistered[playerid] != 1)
{
mysql_format(MySQLTunnel, Query, sizeof(Query), "SELECT `pskin`, `pteam` FROM `accounts` WHERE `pid` = '%d'", pinfo[playerid][pMySQLID]);
new Cache:result = mysql_query(MySQLTunnel, Query);
if(cache_get_row_count() != 0)
{
pinfo[playerid][Skin] = cache_get_field_content_int(0, "pskin");
pinfo[playerid][Team] = cache_get_field_content_int( 0, "pteam");
SetPlayerSkin(playerid,pinfo[playerid][Skin]);
}
cache_delete(result);
SetSpawnInfo(playerid, pinfo[playerid][Team], pinfo[playerid][Skin], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
return 1;
}
Give it a try
pawn Code:
|
if(recentlyregistered[playerid] == 1)
{
//here along with the sql update
}
I guess recentlyregistered[playerid] turn to 1 once if someone register and i think you should place the team spawn inside of
pawn Code:
Creating table when the gamemode starts doesn't cause any problems but manual creation recommended. |