mSelection not working:
#1

The following code doesn't work. It's set to show if the player is a newly registered players, and it does. But when you click on a skin or on a button, nothing happens: it just stays there, frozen. What should I do?

pawn Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    new string[35];

    if(listid == skinlist)
    {
        if(response)
        {
            format(string, 30, "{3685BA}SERVER: {FFFFFF}You have set your skin to ID %d!", modelid);
            SendClientMessage(playerid, -1, string);
            SetPlayerSkin(playerid, modelid);
            return 1;
        }

        else SendClientMessage(playerid, -1, "{3685BA}SERVER: {FFFFFF}You must select a skin.");
        ShowModelSelectionMenu(playerid, skinlist, "Skin Selection");
        return 1;
    }
   
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(pNewlyRegged[playerid])
    {
        ShowModelSelectionMenu(playerid, skinlist, "Skin Selection");
        RandomSpawnLoc(playerid);
    }

    if(IsPlayerConnected(playerid))
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        SetPlayerToTeamColor(playerid);
        Logged[playerid] = 1;
    }
   
    if(PlayerInfo[playerid][pPos_x] == 0 && PlayerInfo[playerid][pPos_y] == 0)
    {
        SetPlayerPos(playerid, 1271.3654,181.0756,19.4705);
        Logged[playerid] = 1;
    }
    else
    {
        SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
        Logged[playerid] = 1;
    }
   
    return 1;
}
Reply
#2

Do you have the skin notepad in the scriptfiles or mselection defines?
Reply
#3

Make sure you have defined the files first.

Try this:
pawn Код:
#include <a_samp>
#include <mSelection>

new skinlist = mS_INVALID_LISTID;
public OnFilterScriptInit()
{
    skinlist = LoadModelSelectionMenu("skins.txt");
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(pNewlyRegged[playerid])
    {
        ShowModelSelectionMenu(playerid, skinlist, "Skin Selection");
        RandomSpawnLoc(playerid);
    }

    if(IsPlayerConnected(playerid))
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        SetPlayerToTeamColor(playerid);
        Logged[playerid] = 1;
    }

    if(PlayerInfo[playerid][pPos_x] == 0 && PlayerInfo[playerid][pPos_y] == 0)
    {
        SetPlayerPos(playerid, 1271.3654,181.0756,19.4705);
        Logged[playerid] = 1;
    }
    else
    {
        SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
        Logged[playerid] = 1;
    }

    return 1;
}

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
   
    if(listid == skinlist)
    {
        if(response)
        {
            new string[35];
            format(string, 30, "{3685BA}SERVER: {FFFFFF}You have set your skin to ID %d!", modelid);
            SendClientMessage(playerid, -1, string);
        }
        else SendClientMessage(playerid, -1, "{3685BA}SERVER: {FFFFFF}You must select a skin.");
        ShowModelSelectionMenu(playerid, skinlist, "Skin Selection");
        return 1;
    }
    return 1;
}
Also, make sure you have skins.txt in your scriptfiles folder.
Reply
#4

The include was there, so was "skinlist". So that's definitely not the problem. And yes, there was the skins.txt file in the Scriptfiles folder.

pawn Код:
#include <mSelection>

new skinlist = mS_INVALID_LISTID;

public OnGameModeInit()
{
    AddPlayerClass(21,-2382.0168,-582.0441,132.1172,125.2504,0,0,0,0,0,0);
    AddPlayerClass(59,-2382.0168,-582.0441,132.1172,125.2504,0,0,0,0,0,0);
    /* <-------------------------------------------> */
    ShowPlayerMarkers(0);
    ShowNameTags(1);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(0);
    SetNameTagDrawDistance(10.0);
    skinlist = LoadModelSelectionMenu("skins.txt");
    // =========== TIMERS ===========
    SetTimer("MoneyUpdate",1000,1);
    SetTimer("SaveAccounts", SECONDS(13), 1);
    return 1;
}
Reply
#5

Hmmm....Are you skipping OnPlayerRequestClass?
Reply
#6

I'm not using the "OnPlayerRequestClass" callback because the skin selection is done after the player spawns. When the player connects to the server, we use a function that hides the spawn buttons.

pawn Код:
TogglePlayerSpectating(playerid, true); // hiding spawn button
Reply
#7

Well,you set player's spectating to true,you must set it to false when showing him the model selection
Reply
#8

You should set the TogglePlayerSpectating to false when you are going to show him the model selection textdraw.

If that doesn't works, then I can't find a way through it, maybe you should debug the script by putting a print function after the OnPlayerModelSelection callback to check weather the callback even works or not.
Also, are you using the latest mSelection version?
Reply
#9

Alright. I added a line to OnPlayerModelSelection callback, a print line, in order to debug. The result? It didn't print.

pawn Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    new string[35];
    print("OnPlayerModelSelection works"); //doesn't print

    if(listid == skinlist)
    {
        if(response)
        {
            format(string, 30, "{3685BA}SERVER: {FFFFFF}You have set your skin to ID %d!", modelid);
            SendClientMessage(playerid, -1, string);
            SetPlayerSkin(playerid, modelid);
            return 1;
        }

        else SendClientMessage(playerid, -1, "{3685BA}SERVER: {FFFFFF}You must select a skin.");
        ShowModelSelectionMenu(playerid, skinlist, "Skin Selection");
        return 1;
    }
   
    return 1;
}
Reply
#10

That means the callback isn't being called...
Do you have the latest version of mSelection?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)