Evil-Cod3r Posted February 11, 2012 Share Posted February 11, 2012 Hi all the Gui Script is Hard for me can some win help me with it iam making a War_Shop Panel GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(324,201,707,349,"Shop_Panel By Evil-Cod3r",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(8,20,226,40,"Welcome :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(401,23,268,24,"Press F7 To Show and Hide The Window",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,0,0) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_TabPanel[1] = guiCreateTabPanel(10,73,688,267,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Buy Weapons",GUIEditor_TabPanel[1]) GUIEditor_Button[1] = guiCreateButton(6,17,201,39,"Buy Sniper $120",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(6,185,202,48,"Buy Armor $250",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(467,183,204,47,"Buy M4 $190",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[3],"clear-normal") GUIEditor_Button[4] = guiCreateButton(450,18,225,46,"Buy Pistol $ 80",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[4],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(215,32,231,184,"images/mtalogo.png",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Send Money",GUIEditor_TabPanel[1]) GUIEditor_Grid[1] = guiCreateGridList(7,13,370,216,false,GUIEditor_Tab[2]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) if col then for _, players in pairs( getElementsByType 'player' ) do guiGridListSetItemText( GUIEditor_Grid[1],row,col,getPlayerName( players ),false,false ) end end for i = 1, 1 do row = guiGridListAddRow(GUIEditor_Grid[1]) end guiGridListSetItemColor(GUIEditor_Grid[1],0,1,0,255,0,255) GUIEditor_Image[2] = guiCreateStaticImage(413,24,240,120,"images/image.png",false,GUIEditor_Tab[2]) GUIEditor_Button[5] = guiCreateButton(411,164,257,57,"Send Money",false,GUIEditor_Tab[2]) guiSetFont(GUIEditor_Button[5],"clear-normal") GUIEditor_Label[3] = guiCreateLabel(726,260,220,22,"Money :",false) guiLabelSetVerticalAlign(GUIEditor_Label[3],"center") guiSetFont(GUIEditor_Label[3],"clear-normal") and i try fix this by my self 100 times dont work to local x,y = guiGetScreenSize() function headshot ( killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/5, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) guiSetVisible ( image, false ) guiSetVisible ( image, true ) guiStaticImageLoadImage(image, "SAMP"..math.random(1,4)..".png") setTimer (guiSetVisible, 4000, 1, image, false ) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), headshot ) function yasser (killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) givePlayerMoney ( killer, 50 ) guiSetVisible(owned, false) guiSetVisible(owned, true) setTimer (guiSetVisible, 4000, 1, owned, false ) end end end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), yasser ) function trigger ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") end end end addEventHandler ( "onPlayerWasted", getRootElement(), trigger) function wastedme () outputChatBox("**Woops Your Dead Try Next Time - $5**",source,255,255,0) takePlayerMoney( source, 5 ) triggerClientEvent(source,"playWastedSound",source,"sounds/3.ogg") end addEventHandler ( "onPlayerWasted", getRootElement ( ), wastedme) Link to comment
FatalTerror Posted February 11, 2012 Share Posted February 11, 2012 What is the problem ? Create functions, you will be lost in your code Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 some help guys i dont know what is the error i did it right talking about 2 script Link to comment
mjau Posted February 11, 2012 Share Posted February 11, 2012 but waht is wrong with it ? explain further, we cant help you fix a script when we have no clue whats wrong... Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 Is onClientPlayerWasted event in the same lua file of onPlayerWasted? lol Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 no Darken i have it as server side but its say Bad argument addEventHandler [Expected function on argument 3 got nill] Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 Line?? It may be fine if you tell us. Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 no line he give me like this Bad argument addEventHandler [Expected function on argument 3 got nill] Link to comment
mjau Posted February 11, 2012 Share Posted February 11, 2012 This i a mess you are mixing serverside and clientside functions.... Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 can some one help me iam not a greate scripter Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 but waht is wrong with it ? explain further, we cant help you fix a script when we have no clue whats wrong... Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 wtf i told you what is worng ! i have but the client in client side and server in server side but see the my post up the worng i post it Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 local x,y = guiGetScreenSize() function headshot ( killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/5, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) guiSetVisible ( image, false ) guiSetVisible ( image, true ) guiStaticImageLoadImage(image, "SAMP"..math.random(1,4)..".png") setTimer (guiSetVisible, 4000, 1, image, false ) end addEventHandler ( "onClientPlayerWasted", root, headshot ) function yasser (killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) givePlayerMoney ( killer, 50 ) guiSetVisible(owned, false) guiSetVisible(owned, true) setTimer (guiSetVisible, 4000, 1, owned, false ) end end end end addEventHandler ( "onClientPlayerWasted", root, yasser ) function trigger ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") end end end addEventHandler ( "onPlayerWasted", root, trigger) function wastedme () outputChatBox("**Woops Your Dead Try Next Time - $5**",source,255,255,0) takePlayerMoney( source, 5 ) triggerClientEvent(source,"playWastedSound",source,"sounds/3.ogg") end addEventHandler ( "onPlayerWasted", root, wastedme) Link to comment
JR10 Posted February 11, 2012 Share Posted February 11, 2012 This just wont work, it has a mix of server and client sided functions. Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 (edited) local sx, sy = guiGetScreenSize() image = guiCreateStaticImage(sx/5,sy/5.8,399,169,'SAMP'..math.random(1,4)..'.png',false) owned = guiCreateStaticImage(0.45,0.6722,0.917,0.0533,'images/owned.png',true) addEventHandler('onClientPlayerWasted', root, function(theKiller,theWeapon,bodyPart) if theKiller and theKiller ~= source then if bodyPart == 9 then outputChatBox('**Owned -> HeadShot!! + $50**',theKiller,255,255,0) playSound('sounds/2.ogg',false) guiSetVisible(owned,true) givePlayerMoney(theKiller,50) setTimer(guiSetVisible,4000,1,owned,false) end else guiSetVisible(image,true) setTimer(guiSetVisible,4000,1,image,false) outputChatBox('** Opps, you dead! Try again - $5 **', source, 255, 255, 0) takePlayerMoney(source,5) playSound('sounds/3.ogg',false) end end end) Edited February 11, 2012 by Guest Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 givePlayerMoney(theKiller,50) Realy ?? its shold be givePlayerMoney(killer,50) Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 No, see function arguments first. Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 wow then can i put it like this if (attacker) and (attacker) =~ source then outputChatBox("Darken Rules !") ? Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 if (attacker and attacker ~= source) then You can, but you have to change the function argument theKiller to your. Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 i test it if i slap my self the images show to me and the outputChatBox(Woops) its show but no sound i need if i kill a player the images show to the killer and then they gone Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 (edited) First, you add the sound to meta? You have the sound in the resource folder ( sounds/3.ogg / 2.ogg )?? You get any error? I don't know if you can show a image only for the local player.. Edited February 11, 2012 by Guest Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 no erros and the meta is 1000% fine and they are in the folders Link to comment
drk Posted February 11, 2012 Share Posted February 11, 2012 Try changing playSound('path',false) to triggerEvent('playSound',theKiller,'songs/2.ogg') Link to comment
Evil-Cod3r Posted February 11, 2012 Author Share Posted February 11, 2012 lol iam the killer ? i salp my self i die its show the images to me ? i want it show to the killer only 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