CMD:buyparts(playerid,params[])
{
new string[64];
if(IsPlayerInRangeOfPoint(playerid, 5.0, -2230.5210,2560.3955,1.8223))
{
format(string, sizeof(string), "Illegal Gun Part Purchasing.");
ShowPlayerDialog(playerid, DIALOG_PARTLIST, DIALOG_STYLE_LIST, string, "{FF0000}Grips\n{FF0000}Frames\n{FF0000}Barrels\n{FF0000}Random Packages", "Select", "Cancel");
}
return 1;
}
else if(dialogid == DIALOG_PARTLIST)
{
printf("CALLED DIALOG_PARTLIST");
if(response == 0)
{
return 1;
}
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, DIALOG_GRIPS, DIALOG_STYLE_LIST, "Available Grips", "Small Grip {FF0000}($300)\nMedium Grip {FF0000}($500)\nLarge Grip{FF0000}($750)", "Buy", "Cancel");
}
case 1:
{
ShowPlayerDialog(playerid, DIALOG_FRAMES, DIALOG_STYLE_LIST, "Available Frames", "Small Frame {FF0000}($1,000)\nMedium Frame {FF0000}($1,500)\nLarge Frame {FF0000}($2,000)", "Buy", "Cancel");
}
case 2:
{
ShowPlayerDialog(playerid, DIALOG_BARRELS, DIALOG_STYLE_LIST, "Available Barrels", "Small Barrel {FF0000}($500)\nMedium Barrel {FF0000}($750)\nLarge Barrel{FF0000}($1,000)", "Buy", "Cancel");
}
case 3:
{
ShowPlayerDialog(playerid, DIALOG_RANDOMS, DIALOG_STYLE_LIST, "Available Random Packages", "Random Grip Package (3) {FF0000}($1,500)\nRandom Frame Package (3){FF0000}($3,000)\nRandom Barrel Package (3) {FF0000}($2,000)", "Buy", "Cancel");
}
}
}
else if(dialogid == DIALOG_RANDOMS)
{
if(response == 0)
{
ShowPlayerDialog(playerid, DIALOG_PARTLIST, DIALOG_STYLE_LIST, "Part Selection", "{FF0000}Grips\n{FF0000}Frames\n{FF0000}Barrels\n{FF0000}Random Packages", "Select", "Cancel");
}
switch(listitem)
{
case 0://Random Package.
{
new str[128];
if(PlayerMoney[playerid] < 1500)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -1500);
new rand[3];
new randStr[3][25];
for(new i = 0; i < sizeof rand; i++)
{
rand[i] = random(3);
switch(rand[i])
{
case 0:
{
format(randStr[i], 25, "Small Grip");
SGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SGrip", SGrip[playerid], "accounts");
}
case 1:
{
format(randStr[i], 25, "Medium Grip");
MGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MGrip", MGrip[playerid], "accounts");
}
case 2:
{
format(randStr[i], 25, "Large Grip");
LGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LGrip", LGrip[playerid], "accounts");
}//case 2
}//switch
}//fornew
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr[0], randStr[1], randStr[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}//actual case
case 1://Random Package.
{
if(PlayerMoney[playerid] < 3000)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -3000);
new rand1[3];
new randStr1[3][25];
for(new i = 0; i < sizeof rand1; i++)
{
rand1[i] = random(3);
switch(rand1[i])
{
case 0:
{
format(randStr1[i], 25, "Small Frame");
SFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SFrame", SFrame[playerid], "accounts");
}
case 1:
{
format(randStr1[i], 25, "Medium Frame");
MFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MFrame", MFrame[playerid], "accounts");
}
case 2:
{
format(randStr1[i], 25, "Large Frame");
LFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LFrame", LFrame[playerid], "accounts");
}//case 2
}//switch
}//switch
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr1[0], randStr1[1], randStr1[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}//case
case 2://Random Package.
{
if(PlayerMoney[playerid] < 2000)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -2000);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
new rand2[3];
new randStr2[3][25];
for(new i = 0; i < sizeof rand2; i++)
{
rand2[i] = random(3);
switch(rand2[i])
{
case 0:
{
format(randStr2[i], 25, "Small Barrel");
SBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SBarrel", SBarrel[playerid], "accounts");
}
case 1:
{
format(randStr2[i], 25, "Medium Barrel");
MBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MBarrel", MBarrel[playerid], "accounts");
}
case 2:
{
format(randStr2[i], 25, "Large Barrel");
LBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LBarrel", LBarrel[playerid], "accounts");
}//case 2
}//switch
}//for
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr2[0], randStr2[1], randStr2[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}//case
}//switch
}//dialog
pawn Код:
|
else if(dialogid == DIALOG_RANDOMS)
{
if(response == 0)
return ShowPlayerDialog(playerid, DIALOG_PARTLIST, DIALOG_STYLE_LIST, "Part Selection", "{FF0000}Grips\n{FF0000}Frames\n{FF0000}Barrels\n{FF0000}Random Packages", "Select", "Cancel");
switch(listitem)
{
case 0://Random Package.
{
new str[128];
if(PlayerMoney[playerid] < 1500)
return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -1500);
new rand[3];
new randStr[3][25];
for(new i = 0; i < sizeof(rand); i++)
{
rand[i] = random(3);
switch(rand[i])
{
case 0:
{
randStr[i] = "Small Grip";
SGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SGrip", SGrip[playerid], "accounts");
}
case 1:
{
randStr[i] = "Medium Grip";
MGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MGrip", MGrip[playerid], "accounts");
}
case 2:
{
randStr[i] = "Large Grip";
LGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LGrip", LGrip[playerid], "accounts");
}
}
break;
}
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr[0], randStr[1], randStr[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}
case 1://Random Package.
{
if(PlayerMoney[playerid] < 3000)
return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -3000);
new rand1[3];
new randStr1[3][25];
for(new i = 0; i < sizeof(rand1); i++)
{
rand1[i] = random(3);
switch(rand1[i])
{
case 0:
{
randStr1[i] = "Small Frame";
SFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SFrame", SFrame[playerid], "accounts");
}
case 1:
{
randStr1[i] = "Medium Frame";
MFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MFrame", MFrame[playerid], "accounts");
}
case 2:
{
randStr1[i] = "Large Frame";
LFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LFrame", LFrame[playerid], "accounts");
}
}
break;
}
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr1[0], randStr1[1], randStr1[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}
case 2://Random Package.
{
if(PlayerMoney[playerid] < 2000)
return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -2000);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
new rand2[3];
new randStr2[3][25];
for(new i = 0; i < sizeof(rand2); i++)
{
rand2[i] = random(3);
switch(rand2[i])
{
case 0:
{
randStr2[i] = "Small Barrel";
SBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SBarrel", SBarrel[playerid], "accounts");
}
case 1:
{
randStr2[i] = "Medium Barrel");
MBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MBarrel", MBarrel[playerid], "accounts");
}
case 2:
{
randStr2[i] = "Large Barrel");
LBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LBarrel", LBarrel[playerid], "accounts");
}
}
break;
}
format(str, sizeof(str),"You got a {33AA33}%s{FFFFFF}, a {33AA33}%s {FFFFFF}and a {33AA33}%s {FFFFFF}from the package.", randStr2[0], randStr2[1], randStr2[2]);
SendClientMessage(playerid, COLOUR_WHITE, str);
}
}
}
randStr[i] = "Small Grip";
format(randStr[i],sizeof(randStr[i]),"Small Grip");