21.12.2015, 18:02
So, you had a logic mistake. :P
Write it like this:
Write it like this:
PHP код:
CMD:order(playerid, params[])
{
if(playerVariables[playerid][pGunLicense] >= 1)
{
if(playerVariables[playerid][pGroup] == 12)
{
new amount;
if(sscanf(params, "d",amount))
{
SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/order [item]");
SendClientMessage(playerid, COLOR_GREY, "Order 1: Deagle");
SendClientMessage(playerid, COLOR_GREY, "Order 2: AK47");
SendClientMessage(playerid, COLOR_GREY, "Order 3: M4A1");
SendClientMessage(playerid, COLOR_GREY, "Order 4: MP5");
SendClientMessage(playerid, COLOR_GREY, "Order 5: Rifle");
}
else if(IsPlayerConnectedEx(playerid))
{
if(groupVariables[playerVariables[playerid][pGroup]][gSafe][1] >= 5000)
{
if(playerVariables[playerid][pMoney] >= 2000)
{
if(IsPlayerInRangeOfPoint(playerid, 100.0, groupVariables[playerVariables[playerid][pGroup]][gGroupInteriorPos][0], groupVariables[playerVariables[playerid][pGroup]][gGroupInteriorPos][1], groupVariables[playerVariables[playerid][pGroup]][gGroupInteriorPos][2]))
{
if(amount == 1)
{
GivePlayerWeapon(playerid, 24, 9999);
playerVariables[playerid][pWeapons][0] = 24;
playerVariables[playerid][pMoney] -= 1000;
groupVariables[playerVariables[playerid][pGroup]][gSafe][1] -= 500;
groupVariables[playerVariables[playerid][pGroup]][gSafe][0] += 1000;
SCM(playerid, COLOR_WHITE,"Ai cumparat un Deagle cu 1.000$. 500 de materiale au fost retrase din seiful factiunii.");
}
else if(amount == 2)
{
GivePlayerWeapon(playerid, 30, 9999);
playerVariables[playerid][pWeapons][1] = 30;
playerVariables[playerid][pMoney] -= 1250;
groupVariables[playerVariables[playerid][pGroup]][gSafe][1] -= 750;
groupVariables[playerVariables[playerid][pGroup]][gSafe][0] += 1250;
SCM(playerid, COLOR_WHITE,"Ai cumparat un AK47 cu 1.250$. 750 de materiale au fost retrase din seiful factiunii.");
}
else if(amount == 3)
{
GivePlayerWeapon(playerid, 31, 9999);
playerVariables[playerid][pWeapons][2] = 31;
playerVariables[playerid][pMoney] -= 1500;
groupVariables[playerVariables[playerid][pGroup]][gSafe][1] -= 1000;
groupVariables[playerVariables[playerid][pGroup]][gSafe][0] += 1500;
SCM(playerid, COLOR_WHITE,"Ai cumparat un M4A1 cu 1.500$. 1.000 de materiale au fost retrase din seiful factiunii.");
}
else if(amount == 4)
{
GivePlayerWeapon(playerid, 29, 9999);
playerVariables[playerid][pWeapons][3] = 29;
playerVariables[playerid][pMoney] -= 1750;
groupVariables[playerVariables[playerid][pGroup]][gSafe][1] -= 1500;
groupVariables[playerVariables[playerid][pGroup]][gSafe][0] += 1750;
SCM(playerid, COLOR_WHITE,"Ai cumparat un MP5 cu 1.750$. 1.500 de materiale au fost retrase din seiful factiunii.");
}
else if(amount == 5)
{
GivePlayerWeapon(playerid, 33, 9999);
playerVariables[playerid][pWeapons][4] = 33;
playerVariables[playerid][pMoney] -= 2000;
groupVariables[playerVariables[playerid][pGroup]][gSafe][1] -= 1750;
groupVariables[playerVariables[playerid][pGroup]][gSafe][0] += 2000;
SCM(playerid, COLOR_WHITE,"Ai cumparat un Riffle cu 2.000$. 1.750 de materiale au fost retrase din seiful factiunii.");
}
else
{
SCM(playerid,COLOR_WHITE,"Invalid order id.");
}
}
}
else return SCM(playerid, COLOR_WHITE, "Nu ai destui bani.");
}
else return SCM(playerid, COLOR_WHITE, "Nu poti cumpara arme deoarece factiunea ta nu are suficiente materiale.");
}
}
}
else
{
SCM(playerid, COLOR_TEAL, "You don't have the gun license");
}
return 1;
}