Taking Out Weapon - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Taking Out Weapon (
/showthread.php?tid=607737)
Taking Out Weapon -
lwilson - 23.05.2016
Okay, I want to make that you have to bring out your weapon from your inventory, before you can use it, like disabling GTA:SA weapon switch, whenever you switch weapon you'll get back to fist. But I don't why it doesn't work. Everytime I buy a weapon from a business, I can still change it likewise.
Код:
OnPlayerUpdate
if (GetPlayerWeapon(playerid) > 1 && (PlayerInfo[playerid][pHoldWeapon] > 0))
SetPlayerArmedWeapon(playerid, 0);
Код:
stock HoldWeapon(playerid, weaponid)
{
RemovePlayerAttachedObject(playerid, 4);
PlayerInfo[playerid][pHoldWeapon] = weaponid;
if (weaponid != 0)
{
SetPlayerAttachedObject(playerid, 4, GetWeaponModel(weaponid), 6);
SetPlayerArmedWeapon(playerid, 0);
}
return 1;
}
Business
Код:
if(listitem == 1)
{
if (GetPlayerCash(playerid) >= BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice1])
{
GivePlayerCash(playerid, -BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice1]);
BizInfo[PlayerInfo[playerid][InBusiness]][bMoney] += BizInfo[PlayerInfo[playerid][InBusiness]][bProductsPrice1];
BizInfo[PlayerInfo[playerid][InBusiness]][bSupplies] --;
GivePlayerValidWeapon(playerid, 33, 5);
format(string, sizeof(string), "[NOTICE]: {FFFFFF}Winchester Model 70 Purchased.");
SendClientMessageEx(playerid, COLOR_LIGHTGREEN, string);
}
else
{
SendClientMessageEx(playerid, COLOR_BRIGHTRED, "[ERROR]: {FFFFFF}You don't have the cash for this item!");
}
}