Jump to content

[Help] My Script GUI >:O


Recommended Posts

wich of that i need to use ?

"weapon_range" - float 
"target_range" - float 
"accuracy" - float 
"damage" - int 
"maximum_clip_ammo" - int 
"move_speed" - float 
"flags" - int (specify a flag to toggle it on/off) See Weapon Flags 
"anim_loop_start" - float 
"anim_loop_stop" - float 
"anim_loop_bullet_fire" - float 
"anim2_loop_start" - float 
"anim2_loop_stop" - float 
"anim2_loop_bullet_fire" - float 
"anim_breakout_time" - float 

Link to comment

Okay Solidsnake can you help me with the part of the setPedStat as it is not alowing me to get the Dual Wield For the Uzi, pistol and Sawn Off Shotgun :( here is the Clients

  
--- --- --- --- --- 
  
-- Created: 09/05/2012 00:59 
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Image = {} 
  
        GUIEditor_Window[1] = guiCreateWindow(224,131,364,323,"Umbrella Corperation's Weapon Shop!",false) 
        guiSetVisible(GUIEditor_Window[1], false) 
        guiSetAlpha(GUIEditor_Window[1],1) 
        GUIEditor_Window[2] = guiCreateWindow(0.25,0.35,0.5,0.2,"UPS!",true) 
        button = guiCreateButton (0.35,0.6,0.3,0.2,"ok",true,GUIEditor_Window[2]) 
        guiSetAlpha(GUIEditor_Window[2],1)     
        label = guiCreateLabel (0.35,0.25,0.5,0.2,"Not enough money for that weapon",true,GUIEditor_Window[2]) 
        guiSetVisible(GUIEditor_Window[2], false) 
        GUIEditor_Button[1] = guiCreateButton(19,39,80,45,"Buy Dildo Large: $500000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[2] = guiCreateButton(144,37,80,45,"Buy Dildo Small: $250000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[3] = guiCreateButton(266,36,80,45,"Buy 50 RPG: $15000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[4] = guiCreateButton(145,119,79,50,"Buy 1000 Pistol Skill: $500000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[5] = guiCreateButton(266,120,85,51,"Buy 1000 Dual Uzi Skill: $1000000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[6] = guiCreateButton(17,120,79,50,"Buy 1000 SawnOff Skill: $750000",false,GUIEditor_Window[1]) 
        GUIEditor_Image[1] = guiCreateStaticImage(14,196,88,73,"images/molotov.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[7] = guiCreateButton(29,271,59,43,"Buy 5 Cocktales: $60000",false,GUIEditor_Window[1]) 
        GUIEditor_Image[2] = guiCreateStaticImage(273,190,75,80,"images/minigun.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[8] = guiCreateButton(280,271,70,43,"Buy 10000 Miniguns:  $100000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[9] = guiCreateButton(114,200,145,99,"EXIT",false,GUIEditor_Window[1]) 
    end 
) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function (player) 
        if (source == GUIEditor_Button[29]) then 
            guiSetVisible (GUIEditor_Window[1],false) 
            showCursor (false) 
        elseif (source == GUIEditor_Button[9]) 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 >= 500000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought a Dildo Large! For: $500000",225,225,0) 
            takePlayerMoney(500000) 
            triggerServerEvent ("give10",getLocalPlayer(),give10) 
            else 
            guiSetVisible(GUIEditor_Window[2],true) 
            guiSetVisible(GUIEditor_Window[1],false) 
            end 
        elseif (source == GUIEditor_Button[2]) then 
            money = getPlayerMoney (source) 
            if (money >= 250000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought a Dildo Small! For: $250000",225,225,0) 
            takePlayerMoney(250000) 
            triggerServerEvent ("give11",getLocalPlayer(),give11) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[3]) then 
            money = getPlayerMoney (source) 
            if (money >= 150000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought a... Seriously?! Nice try Troll!! For: $150000",225,225,0) 
            takePlayerMoney(150000) 
            triggerServerEvent ("give15",getLocalPlayer(),give15) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[8]) then 
            money = getPlayerMoney (source) 
            if (money >= 100000) then 
            player = getLocalPlayer() 
            outputChatBox ("You Nab You Shouldnt Be A Troll! For: $100000",225,225,0) 
            takePlayerMoney(100000) 
            triggerServerEvent ("give14",getLocalPlayer(),give15) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[7]) then 
            money = getPlayerMoney (source) 
            if (money >= 60000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought 5 Cocktails! For: $60000",225,225,0) 
            takePlayerMoney(60000) 
            triggerServerEvent ("give18",getLocalPlayer(),give18) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
       elseif (source == GUIEditor_Button[5]) then 
            money = getPlayerMoney (source) 
            if (money >= 1000000) then 
            outputChatBox ("You bought Dual Uzi Skill For: $1000000",225,225,0) 
            takePlayerMoney(1000000) 
            triggerServerEvent ("setPedStat75",getLocalPlayer()) -- you don't have to put the function as it is on the server-side and the event is attached to the function server side 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[4]) then 
            money = getPlayerMoney (source) 
            if (money >= 500000) then 
            outputChatBox ("You bought Dual Pistol Skill For: $500000",225,225,0) 
            takePlayerMoney(500000) 
            triggerServerEvent ("setPedStat69",getLocalPlayer()) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[6]) then 
            money = getPlayerMoney (source) 
            if (money >= 750000) then 
            outputChatBox ("You bought Dual Sawn Off Skill For: $750000",225,225,0) 
            takePlayerMoney(750000) 
            triggerServerEvent ("setPedStat73",getLocalPlayer()) 
            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],true) 
  
        elseif (source == button) then 
            guiSetVisible(GUIEditor_Window[2],false) 
            guiSetVisible(GUIEditor_Window[1],true) 
             
        end 
    end 
) 
  
        
        
function showGUI () 
guiSetVisible (GUIEditor_Window[1],true) 
showCursor (true) 
end 
addEvent ("showGUI",true) 
addEventHandler ("showGUI",getRootElement(),showGUI) 
  
  
--- --- --- --- --- 

Server:

marker1 = createMarker (295.239,-37.58,1000.515,"cylinder",1.5,0,0,225,100) 
marker2 = createMarker (295.48,-80.38,1000.51,"cylinder",1.5,0,0,225,100) 
marker3 = createMarker (290.28,-109.35,1000.51,"cylinder",1.5,0,0,225,100)  
marker4 = createMarker (211.25,1858.46,12.10,"arrow",1.5,0,0,225,100)  
  
pedammusf = createPed (179,290.187,-111.514,1001.51)  
setElementInterior(pedammusf,6)  
setPedFrozen(pedammusf,true)  
  
pedammulv = createPed (179,295.47,-82.53,1001.51)   
setElementInterior (pedammulv,4) 
  
setElementInterior (marker2,4) 
setElementInterior (marker1,1) 
setElementInterior (marker3,6) 
  
function showGUI (jugador) 
if (source == marker1) then 
triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) 
elseif (source == marker2) then 
triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) 
elseif (source == marker3) then 
triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) 
elseif (source == marker4) then 
triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) 
end 
end 
addEventHandler ("onMarkerHit",getRootElement(),showGUI) 
  
function give10 () 
giveWeapon (source,10,1,true) 
end 
addEvent("give10",true) 
addEventHandler("give10",getRootElement(),give10) 
  
  
function give11 () 
giveWeapon (source,11,1,true) 
end 
addEvent("give11",true) 
addEventHandler("give11",getRootElement(),give11) 
  
  
function give15 () 
giveWeapon (source,15,1,true) 
end 
addEvent("give15",true) 
addEventHandler("give15",getRootElement(),give15) 
  
  
function give14 () 
setWeaponProperty (source,14,1,true) 
end 
addEvent("give14",true) 
addEventHandler("give14",getRootElement(),give14) 
  
  
function setPedStat75 () 
setPedStat (client,75,999,true) 
end 
addEvent("setPedStat75",true) 
addEventHandler("seTPedStat75",getRootElement(),setPedStat75) 
  
  
  
function setPedStat73 () 
setPedStat (client,73,999,true) 
end 
addEvent("setPedStat73",true) 
addEventHandler("setPedStat73",getRootElement(),setPedStat73) 
  
  
function setPedStat69 () 
setPedStat (source,69,999,true) 
end 
addEvent("setPedStat69",true) 
addEventHandler("setPedStat69",getRootElement(),setPedStat69) 

Btw this is kinda urgently needed now the parts with the skill stats i trye the setWeaponProperty Wayyy before i came here, but i didnt know how to set it out Please help! Thanks.

Link to comment

Client-side:

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Image = {} 
  
        GUIEditor_Window[1] = guiCreateWindow(224,131,364,323,"Umbrella Corperation's Weapon Shop!",false) 
        guiSetVisible(GUIEditor_Window[1], false) 
        guiSetAlpha(GUIEditor_Window[1],1) 
        GUIEditor_Window[2] = guiCreateWindow(0.25,0.35,0.5,0.2,"UPS!",true) 
        button = guiCreateButton (0.35,0.6,0.3,0.2,"ok",true,GUIEditor_Window[2]) 
        guiSetAlpha(GUIEditor_Window[2],1)     
        label = guiCreateLabel (0.35,0.25,0.5,0.2,"Not enough money for that weapon",true,GUIEditor_Window[2]) 
        guiSetVisible(GUIEditor_Window[2], false) 
        GUIEditor_Button[1] = guiCreateButton(19,39,80,45,"Buy Dildo Large: $500000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[2] = guiCreateButton(144,37,80,45,"Buy Dildo Small: $250000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[3] = guiCreateButton(266,36,80,45,"Buy 50 RPG: $15000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[4] = guiCreateButton(145,119,79,50,"Buy 1000 Pistol Skill: $500000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[5] = guiCreateButton(266,120,85,51,"Buy 1000 Dual Uzi Skill: $1000000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[6] = guiCreateButton(17,120,79,50,"Buy 1000 SawnOff Skill: $750000",false,GUIEditor_Window[1]) 
        GUIEditor_Image[1] = guiCreateStaticImage(14,196,88,73,"images/molotov.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[7] = guiCreateButton(29,271,59,43,"Buy 5 Cocktales: $60000",false,GUIEditor_Window[1]) 
        GUIEditor_Image[2] = guiCreateStaticImage(273,190,75,80,"images/minigun.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[8] = guiCreateButton(280,271,70,43,"Buy 10000 Miniguns:  $100000",false,GUIEditor_Window[1]) 
        GUIEditor_Button[9] = guiCreateButton(114,200,145,99,"EXIT",false,GUIEditor_Window[1]) 
    end 
) 
  
addEventHandler("onClientGUIClick",root,function()--You've triggered onClientGUIClick, the source of the event is the button that the player/client clicked 
        if (source == GUIEditor_Button[29]) then 
            guiSetVisible (GUIEditor_Window[1],false) 
            showCursor (false) 
        elseif (source == GUIEditor_Button[9]) 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 (localPlayer) 
            if (money >= 500000) then 
            outputChatBox ("You bought a Dildo Large! For: $500000",225,225,0) 
            takePlayerMoney(500000) 
            triggerServerEvent ("give10",getLocalPlayer(),give10) 
            else 
            guiSetVisible(GUIEditor_Window[2],true) 
            guiSetVisible(GUIEditor_Window[1],false) 
            end 
    elseif (source == GUIEditor_Button[2]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 250000) then 
            outputChatBox ("You bought a Dildo Small! For: $250000",225,225,0) 
            takePlayerMoney(250000) 
            triggerServerEvent ("give11",getLocalPlayer(),give11) 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[3]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 150000) then 
            outputChatBox ("You bought a... Seriously?! Nice try Troll!! For: $150000",225,225,0) 
            takePlayerMoney(150000) 
            triggerServerEvent ("give15",getLocalPlayer(),give15) 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[8]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 100000) then 
            outputChatBox ("You Nab You Shouldnt Be A Troll! For: $100000",225,225,0) 
            takePlayerMoney(100000) 
            triggerServerEvent ("give14",getLocalPlayer(),give15) 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[7]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 60000) then 
            outputChatBox ("You bought 5 Cocktails! For: $60000",225,225,0) 
            takePlayerMoney(60000) 
            triggerServerEvent ("give18",getLocalPlayer(),give18) 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[5]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 1000000) then 
            outputChatBox ("You bought Dual Uzi Skill For: $1000000",225,225,0) 
            takePlayerMoney(1000000) 
            triggerServerEvent ("setPedStat75",getLocalPlayer()) -- you don't have to put the function as it is on the server-side and the event is attached to the function server side 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[4]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 500000) then 
            outputChatBox ("You bought Dual Pistol Skill For: $500000",225,225,0) 
            takePlayerMoney(500000) 
            triggerServerEvent ("setPedStat69",getLocalPlayer()) 
        else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
        end 
    elseif (source == GUIEditor_Button[6]) then 
        money = getPlayerMoney (localPlayer) 
        if (money >= 750000) then 
            outputChatBox ("You bought Dual Sawn Off Skill For: $750000",225,225,0) 
            takePlayerMoney(750000) 
            triggerServerEvent ("setPedStat73",getLocalPlayer()) 
        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],true) 
    elseif (source == button) then 
        guiSetVisible(GUIEditor_Window[2],false) 
        guiSetVisible(GUIEditor_Window[1],true) 
    end 
end) 
  
addEvent ("showGUI",true) 
addEventHandler ("showGUI",root,function() 
    guiSetVisible(GUIEditor_Window[1],true) 
    showCursor(true) 
end) 

BTW, The source of the event "onClientGUIClick" is the button or the element the client/local player clicked: onClientGUIClick

Server-side:

marker1 = createMarker (295.239,-37.58,1000.515,"cylinder",1.5,0,0,225,100) 
marker2 = createMarker (295.48,-80.38,1000.51,"cylinder",1.5,0,0,225,100) 
marker3 = createMarker (290.28,-109.35,1000.51,"cylinder",1.5,0,0,225,100) 
marker4 = createMarker (211.25,1858.46,12.10,"arrow",1.5,0,0,225,100) 
  
pedammusf = createPed (179,290.187,-111.514,1001.51) 
setElementInterior(pedammusf,6) 
setPedFrozen(pedammusf,true) 
  
pedammulv = createPed (179,295.47,-82.53,1001.51)   
setElementInterior (pedammulv,4) 
  
setElementInterior (marker2,4) 
setElementInterior (marker1,1) 
setElementInterior (marker3,6) 
  
  
addEventHandler ("onMarkerHit",root,function(jugador) 
    if (source == marker1) then 
        triggerClientEvent (jugador,"showGUI",root) 
    elseif (source == marker2) then 
        triggerClientEvent (jugador,"showGUI",root) 
    elseif (source == marker3) then 
        triggerClientEvent (jugador,"showGUI",root) 
    elseif (source == marker4) then 
        triggerClientEvent (jugador,"showGUI",root) 
    end 
end) 
  
addEvent("give10",true) 
addEventHandler("give10",root,function() 
giveWeapon (client,10,1,true) 
end) 
  
addEvent("give11",true) 
addEventHandler("give11",root,function() 
giveWeapon (client,11,1,true) 
end) 
  
  
  
addEvent("give15",true) 
addEventHandler("give15",root,function() 
giveWeapon (client,15,1,true) 
end) 
  
  
  
addEvent("give14",true) 
addEventHandler("give14",root,function() 
setWeaponProperty (client,14,1,true) 
end) 
  
addEvent("setPedStat75",true) 
addEventHandler("seTPedStat75",root,function() 
setPedStat (client,75,999) 
end) 
  
addEvent("setPedStat73",true) 
addEventHandler("setPedStat73",root,function() 
setPedStat (client,73,999) 
end) 
  
addEvent("setPedStat69",true) 
addEventHandler("setPedStat69",root,function() 
setPedStat (source,69,999) 
end) 

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...