Loading a saved skin
#1

Hello,

I've successfuly made skin saving system in my registration system which is using y_ini that I learned it from Kush's tutorial. So, the skin saves in the data file( Playername.ini ), but my problem now is I am facing this problem on player connect, it shows the Class selection and I have no idea how to make it actually load the skin that a player has(saved in his data file). That's the ideas I came up with but they didn't work:

pawn Код:
AddPlayerClass(GetPlayerSkin(i), xspawn, yspawn, zspawn, aspawn, 0, 0, 0, 0, 0, 0);
Putting that under OnGameModeInIt and on the class selection function. But it seems that it doesn't work and I know it doesn't make sense too, lol. But unfortunatley, I didn't have any other idea on how to make it load, If you want the code just tell me which one should I post.

P.S, Here is the other idea that I came up with but it didn't work too,

pawn Код:
public OnPlayerSpawn(playerid)
{
    GetPlayerSkin(playerid);
    return 1;
}
And I am still learning so, I hope I don't face meany replies :'3.

EDIT: I've put this

pawn Код:
SetPlayerSkin(playerid,GetPlayerSkin(playerid));
Under OnPlayerSpawn, but it didn't work too. Maybe it's because the " Spawn " button at the first screen when you join a server? How to disable it?

EDIT 2: I've found a code that skips the Player class selection window, but the skin still is not loading, I used this code to skip the Class selection:

pawn Код:
forward SpawnPlaya(playerid);
public OnPlayerRequestClass(playerid, classid)
{
    SetTimerEx("SpawnPlaya", 10, false, "i", playerid);
    return 1;
}
public SpawnPlaya(playerid)
{
    SpawnPlayer(playerid);
}
Reply
#2

Try adding a player class with any skin, and as soon as the player logs in, before he spawns, setplayerskin while he's in the class section, and when he spawns he should spawn with the skin you saved. I tried this a while ago, and it worked with dini, so you might as well give it a shot. good luck, if luck exists in scripting
Reply
#3

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
Try adding a player class with any skin, and as soon as the player logs in, before he spawns, setplayerskin while he's in the class section, and when he spawns he should spawn with the skin you saved. I tried this a while ago, and it worked with dini, so you might as well give it a shot. good luck, if luck exists in scripting
Hm, it's a good idea. But for what you're saying I can't at the moment - Read "Edit2" at the main post.
Reply
#4

I dont really understand what you mean, but this is how i did it:
under OnGameModeInIt:
Код:
AddPlayerClass(0, spawnx, spawny, spawnz, spawnangle, wep,ammo, wep,ammo, wep,ammo);
and then under OnPlayerRequestClass, go into the players file (before he logs in if necessary), get his skin, and then
Код:
SetPlayerSkin(playerid, playerskin);
That's what i got in my script, hope it helps.
Reply
#5

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
I dont really understand what you mean, but this is how i did it:
under OnGameModeInIt:
Код:
AddPlayerClass(0, spawnx, spawny, spawnz, spawnangle, wep,ammo, wep,ammo, wep,ammo);
and then under OnPlayerRequestClass, go into the players file (before he logs in if necessary), get his skin, and then
Код:
SetPlayerSkin(playerid, playerskin);
That's what i got in my script, hope it helps.
Hm interesting, but what did you define the wep and ammo? And how did you use the playerskin in SetPlayerSkin? Do you have a GetPlayerSkin before it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)