Wei Posted April 7, 2012 Posted April 7, 2012 Hi. How can I add here when player repair car he will get 1000$ CODE: function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if (weapon == 41 and hitElement and getElementType(hitElement)=="vehicle") then if getElementHealth(hitElement) >= 1000 then return end setElementHealth(hitElement, getElementHealth(hitElement)+100) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) Diet with russian vodka, lose 3 days in one week !
Kenix Posted April 7, 2012 Posted April 7, 2012 Hi. How can I add here when player repair car he will get 1000$ CODE: function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if (weapon == 41 and hitElement and getElementType(hitElement)=="vehicle") then if getElementHealth(hitElement) >= 1000 then return end setElementHealth(hitElement, getElementHealth(hitElement)+100) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) givePlayerMoney http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted April 7, 2012 Author Posted April 7, 2012 Hi. How can I add here when player repair car he will get 1000$ CODE: function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if (weapon == 41 and hitElement and getElementType(hitElement)=="vehicle") then if getElementHealth(hitElement) >= 1000 then return end setElementHealth(hitElement, getElementHealth(hitElement)+100) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) givePlayerMoney You've helped me a lot! Diet with russian vodka, lose 3 days in one week !
Castillo Posted April 7, 2012 Posted April 7, 2012 @Blazy: Use triggerServerEvent to give the money, because if you give it client side it won't sync it. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted April 7, 2012 Author Posted April 7, 2012 Doesn't work. Server: function givemoney(thePlayer) givePlayerMoney( thePlayer, 1000 ) end addEvent( "givemoney", true ) addEventHandler( "givemoney", thePlayer, givemoney ) Client function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (weapon == 41 and hitElement and getElementType(hitElement)=="vehicle") then if getElementHealth(hitElement) >= 1000 then return end setElementHealth(hitElement, getElementHealth(hitElement)+100) triggerServerEvent ( "givemoney", getLocalPlayer()) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) Diet with russian vodka, lose 3 days in one week !
Castillo Posted April 7, 2012 Posted April 7, 2012 function givemoney ( ) givePlayerMoney ( source, 1000 ) end addEvent( "givemoney", true ) addEventHandler( "givemoney", root, givemoney ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted April 7, 2012 Author Posted April 7, 2012 Now it gives me 3000$ why ? (FIXED) But there is 1 bug more. When Player is in the car it doesn't Repair car. But gives me money. Diet with russian vodka, lose 3 days in one week !
Jaysds1 Posted April 8, 2012 Posted April 8, 2012 addEventHandler ( "onClientPlayerWeaponFire", localPlayer,function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (weapon == 41 and hitElement and getElementType(hitElement)=="vehicle") then if getElementHealth(hitElement) >= 1000 then return end setElementHealth(hitElement, getElementHealth(hitElement)+100) fixVehicle(hitElement) triggerServerEvent ( "givemoney", getLocalPlayer()) end end) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Kenix Posted April 8, 2012 Posted April 8, 2012 addEventHandler( "givemoney", thePlayer, givemoney ) lol? Your attach element ( thePlayer ) here is nil. https://wiki.multitheftauto.com/wiki/AddEventHandler http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted April 8, 2012 Author Posted April 8, 2012 Thanks. Solved that. I didn't want to open new post so i'm asking here. Why it doesn't open the window? window = guiCreateWindow(325,111,482,473,"SHG User Panel",false) guiWindowSetSizable(window,false) grid1 = guiCreateGridList(242,30,228,347,false,window) guiGridListSetSelectionMode(grid1,2) guiGridListAddColumn(grid1,"Player Name",0.2) guiGridListAddColumn(grid1,"Wanted",0.2) guiSetAlpha(grid1,0.69999998807907) pinunpinplayer = guiCreateButton(250,392,215,69,"Pin / Unpin Player",false,window) EDchat = guiCreateButton(22,33,210,69,"Enable / Disable Chat",false,window) becomecivilanB = guiCreateButton(24,270,210,69,"Become civilan",false,window) suicideB = guiCreateButton(25,192,210,69,"Suicide",false,window) EDhud = guiCreateButton(23,112,210,69,"Enable / Disable Hud",false,window) shglabel = guiCreateLabel(57,372,138,61,"SHG",false,window) guiSetFont(shglabel,"sa-gothic") function resourceStart () bindKey ("F4", "down", menuShow) end addEventHandler ("onClientResourceStart", getResourceRootElement ( getThisResource () ), resourceStart) function menuShow () visableornot = guiGetVisible (window) if (visableornot == true) then guiSetVisible (window, false) showCursor (false) end if (visableornot == false) then guiSetVisible (window, true) showCursor (true) end end Diet with russian vodka, lose 3 days in one week !
Kenix Posted April 8, 2012 Posted April 8, 2012 window = guiCreateWindow(325,111,482,473,"SHG User Panel",false) guiWindowSetSizable(window,false) grid1 = guiCreateGridList(242,30,228,347,false,window) guiGridListSetSelectionMode(grid1,2) guiGridListAddColumn(grid1,"Player Name",0.2) guiGridListAddColumn(grid1,"Wanted",0.2) guiSetAlpha(grid1,0.69999998807907) pinunpinplayer = guiCreateButton(250,392,215,69,"Pin / Unpin Player",false,window) EDchat = guiCreateButton(22,33,210,69,"Enable / Disable Chat",false,window) becomecivilanB = guiCreateButton(24,270,210,69,"Become civilan",false,window) suicideB = guiCreateButton(25,192,210,69,"Suicide",false,window) EDhud = guiCreateButton(23,112,210,69,"Enable / Disable Hud",false,window) shglabel = guiCreateLabel(57,372,138,61,"SHG",false,window) guiSetFont(shglabel,"sa-gothic") guiSetVisible( window, false ) function menuShow () guiSetVisible( window, not guiGetVisible( window ) ) showCursor( not isCursorShowing( ) ) end bindKey ("F4", "down", menuShow ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted April 8, 2012 Author Posted April 8, 2012 Thanks man ! Diet with russian vodka, lose 3 days in one week !
Kenix Posted April 9, 2012 Posted April 9, 2012 No problem http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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