SA-MP Forums Archive
ShowModelSelectionMenu CRASH - 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: ShowModelSelectionMenu CRASH (/showthread.php?tid=427259)



ShowModelSelectionMenu CRASH - ZackBoolaro - 01.04.2013

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.


Re: ShowModelSelectionMenu CRASH - Pawnie - 01.04.2013

What does it crash? Pawn or ?


You forgot to add return value OnGameModeInit


Код:
return 1;



Re: ShowModelSelectionMenu CRASH - ZackBoolaro - 01.04.2013

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.


Re: ShowModelSelectionMenu CRASH - Azazelo - 01.04.2013

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


Re: ShowModelSelectionMenu CRASH - ZackBoolaro - 01.04.2013

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?


Re: ShowModelSelectionMenu CRASH - Azazelo - 01.04.2013

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


Re: ShowModelSelectionMenu CRASH - ZackBoolaro - 01.04.2013

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.


Re: ShowModelSelectionMenu CRASH - Azazelo - 01.04.2013

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.


Re: ShowModelSelectionMenu CRASH - ZackBoolaro - 01.04.2013

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


Re: ShowModelSelectionMenu CRASH - Azazelo - 01.04.2013

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)).