Skin save on class choose
#1

i have saving sytem and i updated it so now save skin too but one problem is how i can do so when player connect and after login class selection wont show, so player spawn after login auto.
Reply
#2

SpawnPlayer.
Reply
#3

how?
Reply
#4

just add Spawn(playerid); in code of login.It works i think but i wont tried before
Reply
#5

doesnt work i added that after login and nothing
Reply
#6

SpawnPlayer(playerid);
Reply
#7

yes yes i get error and changed then i compile and no errors but ingame = same
Reply
#8

Try it under public OnPlayerRequestClass(playerid, classid)

pawn Код:
if(ChecAccount(playerid) != 0) // Accounts Exists
{
    SetPlayerSkin(playerid, /*get skin id from file/mysql*/);
    SpawnPlayer(playerid);
}
Reply
#9

Код:
C:\Users\Beljulji\Documents\Samp Server\gamemodes\UltimateStunt.pwn(8935) : error 017: undefined symbol "ChecAccount"
C:\Users\Beljulji\Documents\Samp Server\gamemodes\UltimateStunt.pwn(8937) : error 029: invalid expression, assumed zero
C:\Users\Beljulji\Documents\Samp Server\gamemodes\UltimateStunt.pwn(8937) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
onplayerconnect
Код:
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
		return 1;
  	}
onplayerdisconnect
Код:
if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
	{
		new INI:file = INI_Open(Path(playerid)); //will open their their file
	    INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
	 	INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
		INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
		INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his score inside of his account
		INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//As explained above
		INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
		INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        INI_WriteInt(file,"Skin",GetPlayerSkin(playerid));
		INI_Close(file);//Now after we've done saving their data, we now need to close the file
		iPlayerChatTime[playerid] = 0;
	    szPlayerChatMsg[playerid] = "";
		return 1;
	}
Код:
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
    ("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length or hashed user's password. Whirlpool will hash 128 characters + NULL*/
    INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
    INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
    INI_Int("Money",pInfo[playerid][Money]); //As explained above
    INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
    INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
    INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
    INI_Int("Skin",pInfo[playerid][Deaths]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)