PDA

View Full Version : Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit?


newbienoob
13/02/2014, 09:57 AM
I have 300 skins under OnGamemodeInit

for(new skins = 0, skins2 = 300; skins < skins2; skins++)
{
AddPlayerClass(skins, 1544.7887,-1675.4630,13.5591, 90.0, 0, 0,0 ,0,0,0);
}

It shows skin 0, 1, 2, ... 299 as I scripted it that way. But I want to show, let's say 29 first (depends on player's saved skin), then 0, 1, 2, 3, ... How am I gonna do that? I've tried adding AddPlayerClass(pInfo[playerid][Skin], 1544.7887,-1675.4630,13.5591, 90.0, 0, 0,0 ,0,0,0) under OnPlayerRequestClass, but no luck.

Beckett
13/02/2014, 10:01 AM
What you wanna do, exactly?

newbienoob
13/02/2014, 10:08 AM
Showing saved player's skin(from sql/ini) in class selection first, then skin 0, 1, 2, 3... 299 when player clicks >>

RajatPawar
13/02/2014, 10:12 AM
You can do something like -



new someSkin = 12; // A skin you want to hide

public OnPlayerRequestClass(playerid,classid)
{
if(classid == someSkin)
{
SetPlayerSkin(playerid, classid + 1); // Skip that classID
}
return 1;
}


Untested, but COULD work.

Konstantinos
13/02/2014, 10:14 AM
I don't think it's possible to change the classes after they've been created.

The only possible way is SetPlayerSkin. After logging in, set the skin to the saved one and if the player clicks on the next skin, use GetPlayerSkin and check if the skinid is the saved one + 1 and set it to 0. Else if the player clicks on the previous skin, get the skin and if it's the saved one - 1, then set to 299.

Note that skinid 74 is not valid, so in the loop:

if (skins == 74) continue;

above AddPlayerClass line.

newbienoob
13/02/2014, 10:26 AM
Actually it is possible Konstantinos. I've got this idea from Rajat_Pawar's code.

AddPlayerClass(74, 1544.7887,-1675.4630,13.5591, 90.0, 0, 0,0 ,0,0,0);
for(new skins = 0, skins2 = 300; skins < skins2; skins++)
{
AddPlayerClass(skins, 1544.7887,-1675.4630,13.5591, 90.0, 0, 0,0 ,0,0,0);
}

//requestclass
if(classid == 0) SetPlayerSkin(playerid, pInfo[playerid][Skin]); //if classid 0 or skin 74, replace with saved skin

But, for some reason, it hides Claude's skin :/
EDIT: Ok, I have fixed it by just adding if(skins == 74) continue;
Server only shows 300 skins. I have 301 skins. So adding ^ makes it 300

ColeMiner
13/02/2014, 10:27 AM
It is possible, but currently the only way to change the skin selection screen after a player connects is with y_classes.

newbienoob
13/02/2014, 10:32 AM
It is possible, but currently the only way to change the skin selection screen after a player connects is with y_classes.
Thanks. But I have figured out the another way. Check your above post :D