ShowModelSelectionMenu CRASH
#1

Okay so, i'm trying to script a re-script my clothing shop system. All I was that I replaced the dialog that shows up on /buyclothes with the code below(of course i've placed the code onto the correct places):
pawn Код:
#include <mSelection>

new skinlist = mS_INVALID_LISTID;

OnGameModeInit(){
        skinlist = LoadModelSelectionMenu("skins.txt");
}

CMD:buyclothes(playerid, params[])
{
    if(IsAtClothShop(playerid))
    {
        ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
    }
    else
    {
        SendClientMessage( playerid, COLOR_WHITE, "You are not in a Clothing Store!" );
    }
    return 1;
}

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(listid == skinlist)
    {
        if(response)
        {
            new string[128];
            format(string, sizeof(string), "** You have purchased skinid: %i for $600", modelid);
            SendClientMessageEx(playerid, 0xFF0000FF, string);
            SetPlayerSkin(playerid, modelid);
            GivePlayerCash(playerid, -600);
            PlayerInfo[playerid][pModel] = modelid;
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
        return 1;
    }
    return 1;
}
and here is my skins.txt: Pastebin
Firstly it said that "mS_CUSTOM_MAX_ITEMS" had to be increased, good I increased them to 300 but still, when i type the command i crash.
Reply
#2

What does it crash? Pawn or ?


You forgot to add return value OnGameModeInit


Код:
return 1;
Reply
#3

I forgot to type the return 1 ony here. I have it on my script. And what's not to understand for "when i type the command i crash". I'm clearly stating that i TYPE the command and i crash. That' means when i'm in-game.
Reply
#4

try this:

Код:
CMD:buyclothes(playerid, params[])
{
    if(IsAtClothShop(playerid))
    {  
        print("Test 1");
        ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
        print("Test 2");
    }
    else
    {
        SendClientMessage( playerid, COLOR_WHITE, "You are not in a Clothing Store!" );
    }
    return 1;
And see in log is it print Test1 and Test2
Reply
#5

Quote:
Originally Posted by Azazelo
Посмотреть сообщение
try this:

Код:
CMD:buyclothes(playerid, params[])
{
    if(IsAtClothShop(playerid))
    {  
        print("Test 1");
        ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
        print("Test 2");
    }
    else
    {
        SendClientMessage( playerid, COLOR_WHITE, "You are not in a Clothing Store!" );
    }
    return 1;
And see in log is it print Test1 and Test2
You gotta be kidding me? How's that going to change anything? Anyway just to tryed it.. and it's not working, just as i thought. Can someone with a real resolution help me out please?
Reply
#6

Now what you server_log.txt say? is called "Debugging"...
Reply
#7

It says nothing...
I just get the prints you told me to put in:
[05:29:47] [zcmd] [Soap MacTavish]: /buyclothes
[05:29:47] Test 1
[05:29:47] Test 2

and i crash after that.
Reply
#8

Ok so problem must be then in you callback :
Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{  
    print("Test 1");
    if(listid == skinlist)
    { 
        print("Test 2");
        if(response)
        { 
            print("Test 3");
            new string[128];
            format(string, sizeof(string), "** You have purchased skinid: %i for $600", modelid);
            SendClientMessageEx(playerid, 0xFF0000FF, string);
            SetPlayerSkin(playerid, modelid);
            GivePlayerCash(playerid, -600);
            PlayerInfo[playerid][pModel] = modelid;
            print("Test 4");
            
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
        return 1;
    }
    return 1;
}
Test it and see log.
Reply
#9

Quote:
Originally Posted by Azazelo
Посмотреть сообщение
try this:

Код:
CMD:buyclothes(playerid, params[])
{
    if(IsAtClothShop(playerid))
    {  
        print("Test 1");
        ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
        print("Test 2");
    }
    else
    {
        SendClientMessage( playerid, COLOR_WHITE, "You are not in a Clothing Store!" );
    }
    return 1;
And see in log is it print Test1 and Test2
Quote:
Originally Posted by Azazelo
Посмотреть сообщение
Ok so problem must be then in you callback :
Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{  
    print("Test 1");
    if(listid == skinlist)
    { 
        print("Test 2");
        if(response)
        { 
            print("Test 3");
            new string[128];
            format(string, sizeof(string), "** You have purchased skinid: %i for $600", modelid);
            SendClientMessageEx(playerid, 0xFF0000FF, string);
            SetPlayerSkin(playerid, modelid);
            GivePlayerCash(playerid, -600);
            PlayerInfo[playerid][pModel] = modelid;
            print("Test 4");
            
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
        return 1;
    }
    return 1;
}
Test it and see log.
It dosen't even get to the point so it can execute the function, i just get that i typed the command that's it:
[05:45:07] [zcmd] [Soap MacTavish]: /buyclothes
Reply
#10

Is this correct in first attempt you able to see Test 1 and Test 2 in log but now after second test you not?
If this correct then you have problem with if(IsAtClothShop(playerid)).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)