Class resets to Cop? -
vassilis - 20.01.2015
solved
Re: Class resets to Cop? -
nezo2001 - 20.01.2015
I don't know working with mysql but in y_ini you make this
When the player choose the skin do
PHP Code:
pinfo[playerid][skin] = //skinid ;
PHP Code:
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;
}
PHP Code:
OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, pinfo[playerid][skin];
return 1;
}
Re: Class resets to Cop? -
vassilis - 20.01.2015
Quote:
Originally Posted by nezo2001
I don't know working with mysql but in y_ini you make this
When the player choose the skin do
PHP Code:
pinfo[playerid][skin] = //skinid ;
PHP Code:
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;
}
PHP Code:
OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, pinfo[playerid][skin];
return 1;
}
|
You don't really help iask with MySQL since i use mysql but thanks..
Re: Class resets to Cop? -
nezo2001 - 20.01.2015
All the problem to save and load and i think you can convert from y_ini to mysql
Re: Class resets to Cop? -
vassilis - 20.01.2015
I need someone with MySQL Knowledge to help me :/
Re: Class resets to Cop? -
vassilis - 21.01.2015
still unsolved lol
Re: Class resets to Cop? -
Ironboy - 21.01.2015
Give it a try
pawn 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;
}
Re: Class resets to Cop? -
vassilis - 21.01.2015
Quote:
Originally Posted by Ironboy
Give it a try
pawn 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; }
|
Ok so i tried yours and i added the and printedf to check whats the problem i noticed that on print it says the correct skin and team (SKIN 292 TEAM 5(TEAM CIVILIAN) ) BUT i get spawned as cop...
Re: Class resets to Cop? -
Ironboy - 22.01.2015
I guess recentlyregistered[playerid] turn to 1 once if someone register and i think you should place the team spawn inside of
pawn Code:
if(recentlyregistered[playerid] == 1)
{
//here along with the sql update
}
Quote:
Originally Posted by vassilis
NOTE : I am creating the accounts table when gamemodeinit opens(just for once of course) could this affect in a way the saving? Should i make the table of accounts manually?
|
Creating table when the gamemode starts doesn't cause any problems but manual creation recommended.
Re: Class resets to Cop? -
vassilis - 22.01.2015
Quote:
Originally Posted by Ironboy
I guess recentlyregistered[playerid] turn to 1 once if someone register and i think you should place the team spawn inside of
pawn Code:
if(recentlyregistered[playerid] == 1) { //here along with the sql update }
Creating table when the gamemode starts doesn't cause any problems but manual creation recommended.
|
I noticed that when player registers it doesnt gives him the defualt money integer i have put($3000) but when he relogs so i guess its a problem with loading?