17.07.2014, 15:51
Hello everyone,
i have been playing samp for a while now and now started to script on my own. I still am very new at this scripting stuff thats why i am asking you to be slow on me
Now, i found a script a few years ago and have been working on it since a few weeks. And now i would like to change the toys system it has. I already managed to make a "menu" selection where you choose categories and then choose your toy, the only problem is selection a slot. The script has 10 slots total, and on this current state, when i buy a toy, it goes to slot 0 and overwrites itself when i buy a new one. How can i make it possible to choose a slot ? I would like it to be in a way that you firstly choose a slot, then go to the categories and then to the toys. Here is wht i got till now.
This is the cmd where you make the menu open :
CMD:buytoys(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
ShowDialog(playerid, 340);
return 1;
and here is the menu:
else if(dialogid == 340) //Buytoys
{
if(response)
{
switch(listitem)
{
case 0:
{
ShowDialog(playerid, 341);//Glasses
}
case 1:
{
ShowDialog(playerid, 342);//Watches
}
case 2:
{
ShowDialog(playerid, 343);//Bandanas
}
case 3:
{
ShowDialog(playerid, 344);//Hats
}
case 4:
{
ShowDialog(playerid, 345);//Masks
}
}
}
}
else if(dialogid == 341)
{
new model, Toyindex, params, string[128];
if(response)
{
switch(listitem)
{
case 0 : model = 19006;// Glasses
case 1 : model = 19007;
case 2 : model = 19008;
case 3 : model = 19009;
case 4 : model = 19010;
case 5 : model = 19011;
case 6 : model = 19012;
case 7 : model = 19013;
case 8 : model = 19014;
case 9 : model = 19015;
case 10: model = 19016;
case 11: model = 19017;
case 12: model = 19018;
case 13: model = 19019;
case 14: model = 19020;
case 15: model = 19021;
case 16: model = 19022;
case 17: model = 19023;
case 18: model = 19024;
case 19: model = 19025;
case 20: model = 19026;
case 21: model = 19027;
case 22: model = 19028;
case 23: model = 19029;
case 24: model = 19030;
case 25: model = 19031;
case 26: model = 19032;
case 27: model = 19033;
case 28: model = 19034;
case 29: model = 19035;
}
if(Toyindex < 0 || Toyindex > 9) return SendClientMessage(playerid, COLOR_GREY, "Slots are between 0 and 9.");
PlayerInfo[playerid][pToyModel][Toyindex] = model;
GiveDodMoney(playerid, -1000);
format(string, sizeof(string), "* %s has bought a toy for $1000.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, " You can view and edit your toys using /toys.");
}
}
i have been playing samp for a while now and now started to script on my own. I still am very new at this scripting stuff thats why i am asking you to be slow on me

Now, i found a script a few years ago and have been working on it since a few weeks. And now i would like to change the toys system it has. I already managed to make a "menu" selection where you choose categories and then choose your toy, the only problem is selection a slot. The script has 10 slots total, and on this current state, when i buy a toy, it goes to slot 0 and overwrites itself when i buy a new one. How can i make it possible to choose a slot ? I would like it to be in a way that you firstly choose a slot, then go to the categories and then to the toys. Here is wht i got till now.
This is the cmd where you make the menu open :
CMD:buytoys(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
ShowDialog(playerid, 340);
return 1;
and here is the menu:
else if(dialogid == 340) //Buytoys
{
if(response)
{
switch(listitem)
{
case 0:
{
ShowDialog(playerid, 341);//Glasses
}
case 1:
{
ShowDialog(playerid, 342);//Watches
}
case 2:
{
ShowDialog(playerid, 343);//Bandanas
}
case 3:
{
ShowDialog(playerid, 344);//Hats
}
case 4:
{
ShowDialog(playerid, 345);//Masks
}
}
}
}
else if(dialogid == 341)
{
new model, Toyindex, params, string[128];
if(response)
{
switch(listitem)
{
case 0 : model = 19006;// Glasses
case 1 : model = 19007;
case 2 : model = 19008;
case 3 : model = 19009;
case 4 : model = 19010;
case 5 : model = 19011;
case 6 : model = 19012;
case 7 : model = 19013;
case 8 : model = 19014;
case 9 : model = 19015;
case 10: model = 19016;
case 11: model = 19017;
case 12: model = 19018;
case 13: model = 19019;
case 14: model = 19020;
case 15: model = 19021;
case 16: model = 19022;
case 17: model = 19023;
case 18: model = 19024;
case 19: model = 19025;
case 20: model = 19026;
case 21: model = 19027;
case 22: model = 19028;
case 23: model = 19029;
case 24: model = 19030;
case 25: model = 19031;
case 26: model = 19032;
case 27: model = 19033;
case 28: model = 19034;
case 29: model = 19035;
}
if(Toyindex < 0 || Toyindex > 9) return SendClientMessage(playerid, COLOR_GREY, "Slots are between 0 and 9.");
PlayerInfo[playerid][pToyModel][Toyindex] = model;
GiveDodMoney(playerid, -1000);
format(string, sizeof(string), "* %s has bought a toy for $1000.", RPN(playerid), params);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, " You can view and edit your toys using /toys.");
}
}