PDA

View Full Version : ShowModelSelectionMenu CRASH


ZackBoolaro
01/04/2013, 02:16 AM
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):

#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 (http://pastebin.com/GMU4qJdw)
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.

Pawnie
01/04/2013, 02:18 AM
What does it crash? Pawn or ?


You forgot to add return value OnGameModeInit


return 1;

ZackBoolaro
01/04/2013, 02:38 AM
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.

Azazelo
01/04/2013, 03:00 AM
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

ZackBoolaro
01/04/2013, 03:05 AM
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?

Azazelo
01/04/2013, 03:07 AM
Now what you server_log.txt say? is called "Debugging"...

ZackBoolaro
01/04/2013, 03:09 AM
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.

Azazelo
01/04/2013, 03:13 AM
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.

ZackBoolaro
01/04/2013, 03:20 AM
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

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

Azazelo
01/04/2013, 03:26 AM
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)).

ZackBoolaro
01/04/2013, 03:31 AM
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)).

Dude, i had no problems with my old system that used the function above. Now that i switched to these stupid textdraws i can't get it to work. The problem is in the textdraws or something. Because when i type the command it shows me the textdraw but with no skins inside of it and then i crash.

Azazelo
01/04/2013, 03:36 AM
And why you use include and not this :

Mika2828
05/04/2013, 12:15 PM
Same problem, some users are getting crashes with this modelpreview.