Class resets to Cop?
#1

solved
Reply
#2

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(playeridreason)
{
    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(playeridpinfo[playerid][skin];
return 
1;

Reply
#3

Quote:
Originally Posted by nezo2001
View Post
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(playeridreason)
{
    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(playeridpinfo[playerid][skin];
return 
1;

You don't really help iask with MySQL since i use mysql but thanks..
Reply
#4

All the problem to save and load and i think you can convert from y_ini to mysql
Reply
#5

I need someone with MySQL Knowledge to help me :/
Reply
#6

still unsolved lol
Reply
#7

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;
   }
Reply
#8

Quote:
Originally Posted by Ironboy
View Post
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...
Reply
#9

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
View Post
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.
Reply
#10

Quote:
Originally Posted by Ironboy
View Post
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)