X-SHADOW Posted May 22, 2012 Share Posted May 22, 2012 Hi all i have littel problem with Shop_Weapons is when player try to buy a medKit and his health is 100 % the outputChatBox('Your Health is 100%) else outputChatBox('You Have Bought Medkit') and same as armor addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then money = getPlayerMoney (source) if (money >= 100) then player = getLocalPlayer() outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then money = getPlayerMoney (source) if (money >= 200) then player = getLocalPlayer() outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then money = getPlayerMoney (source) if (money >= 600) then player = getLocalPlayer() outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then money = getPlayerMoney (source) if (money >= 500) then player = getLocalPlayer() outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then money = getPlayerMoney (source) if (money >= 700) then player = getLocalPlayer() outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then money = getPlayerMoney (source) if (money >= 400) then player = getLocalPlayer() outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then money = getPlayerMoney (source) if (money >= 600) then player = getLocalPlayer() outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then money = getPlayerMoney (source) if (money >= 800) then player = getLocalPlayer() outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then money = getPlayerMoney (source) if (money >= 2000) then player = getLocalPlayer() outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then money = getPlayerMoney (source) if (money >= 3000) then player = getLocalPlayer() outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) elseif getElementHealth( localPlayer ) ~= 100 then outputChatBox('Your Health is 100% You Cant Buy MedKit',source,255,255,0) end elseif (source == GUIEditor_Button[26]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) elseif getPedArmor ( localPlayer ) ~= 100 then outputChatBox('Your Armor is Alredy 100% You Cant Buy Armor',source,255,255,0) end elseif (source == GUIEditor_Button[29]) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) end end) Link to comment
AMARANT Posted May 22, 2012 Share Posted May 22, 2012 I really don't get you from what you've said but if you're talking about checking HP and not giving MedKit to the player who already has 100% health then there's solution: if getPlayerMoney( localPlayer ) >= 1000 then if getElementHealth( localPlayer ) < 100 then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000)--I advise you to do it serverside triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else outputChatBox('Your Health is 100% You Cant Buy MedKit',source,255,255,0) end end Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 Yub AMARANT Thats What i mean and dont worry about takePlayerMoney in this mta verison its fixed clientSide and server side work and it dont work go lot of errors . Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 no i was talking about takePlayerMoney to Amarant and the resource its got errors and wont work Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 (edited) try this: addEventHandler("onClientGUIClick",guiRoot, function () money = getPlayerMoney (localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) elseif getElementHealth( localPlayer ) ~= 100 then outputChatBox('Your Health is 100% You Cant Buy MedKit',source,255,255,0) end elseif (source == GUIEditor_Button[26]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) elseif getPedArmor ( localPlayer ) ~= 100 then outputChatBox('Your Armor is Alredy 100% You Cant Buy Armor',source,255,255,0) end elseif (source == GUIEditor_Button[29]) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) end end,true) Edited May 22, 2012 by Guest Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 haha Jaysds1 X-Shadow Comes and fucked up every body alredy fixed befour 20 sec Thank's i realy love you Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 lol, sorry about the code and np Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 Jaysds1 i think i fucked up my slef only its still Buy even if my health and armor == 100 i even try what you post dont work. Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 oh, sorry, change the false to true at the end Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 same thing i just well look to the posts in the fourm to fined a problem like me i dont want make you tired Jaysds1 Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 and i event try this but has erros see addEventHandler("onClientGUIClick",guiRoot, function () money = getPlayerMoney (localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) and getPlayerMoney( source) == 1000 and getElementHealth(source) < 100 then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else outputChatBox('You Health is alredy 100% You Cant Buy This',source,255,0,0) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[26]) and getPlayerMoney( source) 1000 and getPedArmor(source) < 100 then outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) else outputChatBox('Your Armor is Alredy 100% You Cant Buy Armor',source,255,255,0) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == button) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) end end,true) Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 I found the problem, try this: addEventHandler("onClientGUIClick",guiRoot,function() local money = getPlayerMoney(localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then player = getLocalPlayer() outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",localPlayer) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if getElementHealth(localPlayer) == 100 then --Check their health first outputChatBox('Your Health is 100% You Cant Buy MedKit',source,255,255,0) else if money >= 1000 then --forgot then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",localPlayer) end end elseif (source == GUIEditor_Button[26]) then if getPedArmor(localPlayer) == 100 then --check their armor health first outputChatBox('Your Armor is Alredy 100% You Cant Buy Armor',source,255,255,0) else if money >= 1000 then --forgot then outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) end end elseif (source == GUIEditor_Button[29]) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) end end,true) Link to comment
X-SHADOW Posted May 22, 2012 Author Share Posted May 22, 2012 Thank's Man You Are My Hero Working Fine what we well do with out Jaysds1 Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 lol, np and without me you guyz would have to put up with the community which is not on right now Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 Jaysds1 i love to Make gunLinces can you show me how to do gunlinces ? Link to comment
Alpha Posted May 23, 2012 Share Posted May 23, 2012 English only, talk in your language subforum. Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 haha i made 100% of shop without errors like you all bgus . Alpha +1 i well try make it Link to comment
TwiX! Posted May 23, 2012 Share Posted May 23, 2012 Jaysds1 i love to Make gunLincescan you show me how to do gunlinces ? save all in account data on mysql/sql/ etc and later local acc = getPlayerAccount(source) if getAccountData(acc,"onHaveGunLicense") ~= true or 1 then --code else outputChatBox ("* Sorry but you not have a Gun License",source,255,255,255,true) end Link to comment
Alpha Posted May 23, 2012 Share Posted May 23, 2012 Your double check is wrong, you have to getAccountData again for the second check: local acc = getPlayerAccount(source) if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then --code end Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 can i save it on xml files ? Link to comment
Alpha Posted May 23, 2012 Share Posted May 23, 2012 I don't recommend using XML for saving, afaik it eats up a lot of memory. You can use account data or SQLite. Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 so for example well be like this ? --client-side addEvent('onHaveGunLicense', true) addEventHandler('onHaveGunLicense', root, function() button = guiCreateButton('Buy License',0,0,0) end) --serverSide local acc = getPlayerAccount(source) if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then triggerClientEvent('onHaveGunLicense', source) else outputChatBox('You Dont Have GunLicense',source,255,255,0) end Link to comment
TAPL Posted May 23, 2012 Share Posted May 23, 2012 dont worry about takePlayerMoney in this mta verison its fixed clientSide and server side work source? what version? by theway, what was fixed? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now