06.08.2016, 06:35
This is how this upgrade work and its work fine.
But then, when the warehouse is loop, the wh back to level one.
pawn Код:
if(dialogid == 60 && response == 1)
{
switch(listitem)
{
case 0:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
WareHouse[t][whlevel] = 1;
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 1", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
case 1:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
if(PlayerTemp[playerid][sm] < 400000) return SendClientError(playerid, "You do not have enough money");
WareHouse[t][whlevel] = 2;
GivePlayerMoneyEx(playerid, -400000);
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 2", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
case 2:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
if(PlayerTemp[playerid][sm] < 800000) return SendClientError(playerid, "You do not have enough money");
WareHouse[t][whlevel] = 3;
GivePlayerMoneyEx(playerid, -800000);
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 3", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
case 3:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
if(PlayerTemp[playerid][sm] < 1200000) return SendClientError(playerid, "You do not have enough money");
WareHouse[t][whlevel] = 4;
GivePlayerMoneyEx(playerid, -1200000);
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 4", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
case 4:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
if(PlayerTemp[playerid][sm] < 1800000) return SendClientError(playerid, "You do not have enough money");
WareHouse[t][whlevel] = 5;
GivePlayerMoneyEx(playerid, -1800000);
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 5", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
case 5:
{
new wh = IsAtOwnWareHouse(playerid);
WareHouseLoop(t)
{
if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
{
if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
if(PlayerTemp[playerid][sm] < 2500000) return SendClientError(playerid, "You do not have enough money");
WareHouse[t][whlevel] = 6;
GivePlayerMoneyEx(playerid, -2500000);
SaveWareHouse(t);
ReloadWareHouse(t);
format(iStr, sizeof(iStr), "# [%s] %s has upgraded the faction warehouse to level 6", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
}
}
}
}
}
else if(dialogid == 60 && response ==1) return SendClientInfo(playerid, "Canceled");
pawn Код:
WareHouseLoop(wh)
{
SaveWareHouse(wh);
ReloadWareHouse(wh);
if(WareHouse[wh][whlevel] == 1)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 6000, true, "d", wh);
}
else if(WareHouse[wh][whlevel] == 2)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 5000, true, "d", wh);
}
else if(WareHouse[wh][whlevel] == 3)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 4000, true, "d", wh);
}
else if(WareHouse[wh][whlevel] == 4)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 3500, true, "d", wh);
}
else if(WareHouse[wh][whlevel] == 5)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 3000, true, "d", wh);
}
else if(WareHouse[wh][whlevel] == 6)
{
WareHouse[wh][whTimer] = SetTimerEx("AddToWareHouse", 2000, true, "d", wh);
}
}