SA-MP Forums Archive
Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? (/showthread.php?tid=494419)



Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - newbienoob - 13.02.2014

I have 300 skins under OnGamemodeInit
pawn Код:
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.


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - Beckett - 13.02.2014

What you wanna do, exactly?


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - newbienoob - 13.02.2014

Showing saved player's skin(from sql/ini) in class selection first, then skin 0, 1, 2, 3... 299 when player clicks >>


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - RajatPawar - 13.02.2014

You can do something like -

pawn Код:
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.


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - Konstantinos - 13.02.2014

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:
pawn Код:
if (skins == 74) continue;
above AddPlayerClass line.


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - newbienoob - 13.02.2014

Actually it is possible Konstantinos. I've got this idea from Rajat_Pawar's code.
pawn Код:
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


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - ColeMiner - 13.02.2014

It is possible, but currently the only way to change the skin selection screen after a player connects is with y_classes.


Re: Where can I use AddPlayerClass other than OnGamemode/FilterscriptInit? - newbienoob - 13.02.2014

Quote:
Originally Posted by ColeMiner
Посмотреть сообщение
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