11.08.2013, 21:53
It's not that it crashes, basically, i think i've put brackets in wrong places, because i know all the codes right but the problem is that i'm getting like variables already defined errors and if i remove them it says it later on in the script and stuff, i'm so confused.
pawn Код:
else if(dialogid == DIALOG_GUNPARTS)
{
if(response == 0)
{
return 1;
}
switch(listitem)
{
case 0:
{
new string[128];
PlayerMoney[playerid] = GetPlayerMoney(playerid);
if(PlayerMoney[playerid] < 300)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -300);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
SGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SGrip", SGrip[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Small Grip, you now have a total of %d.", SGrip[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 1:
{
new string[128];
if(PlayerMoney[playerid] < 500)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -500);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
MGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MGrip", MGrip[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Medium Grip, you now have a total of %d.", MGrip[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 2:
{
new string[128];
if(PlayerMoney[playerid] < 750)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -750);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
LGrip[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LGrip", LGrip[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Large Grip, you now have a total of %d.", LGrip[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 3://Random Package.
{
if(PlayerMoney[playerid] < 1500)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -1500);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
new rand[3];
new randStr[3][25];
new string[128];
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
format(string, sizeof(string),"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, string);
}//fornew
}//actual case
case 4:
{
new string[128];
if(PlayerMoney[playerid] < 1000)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, - 1000);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
SFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SFrame", SFrame[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Small Frame, you now have a total of %d.", SFrame[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 5:
{
new string[128];
if(PlayerMoney[playerid] < 1500)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -1500);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
MFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MFrame", MFrame[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Medium Frame, you now have a total of %d.", MFrame[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 6:
{
new string[128];
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");
LFrame[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LFrame", LFrame[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Large Frame, you now have a total of %d.", LFrame[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 7://Random Package.
{
if(PlayerMoney[playerid] < 3000)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -3000);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
new string[128];
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
}//fornew
format(string, sizeof(string),"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, string);
}//switch
}//case
case 8:
{
new string[128];
if(PlayerMoney[playerid] < 500)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -500);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
SBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "SBarrel", SBarrel[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Small Barrel, you now have a total of %d.", SBarrel[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 9:
{
new string[128];
if(PlayerMoney[playerid] < 750)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -750);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
MBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "MBarrel", MBarrel[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Medium Barrel, you now have a total of %d.", MBarrel[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 10:
{
new string[128];
if(PlayerMoney[playerid] < 1000)return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money.");
GivePlayerMoney(playerid, -1000);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
LBarrel[playerid] ++;
MySQL_SetInteger(PlayerSQLID[playerid], "LBarrel", LBarrel[playerid], "accounts");
format(string, sizeof(string), "You have purchased a Large Barrel, you now have a total of %d.", LBarrel[playerid]);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
case 11://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];
new string[128];
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(string, sizeof(string),"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, string);
}//case
}//switch
}//dialog