Jump to content

[Help] My Script GUI >:O


Recommended Posts

Here is the client:

  
--- --- --- --- --- 
  
-- 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!",true) 
        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]) 
        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 Viberator: $150000",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: $1500000",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/night.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[8] = guiCreateButton(280,271,70,43,"Buy 1 Night Vision: $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) 
             
            if (source == GUIEditor_Button[1]) 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 Viberater! For: $150000",225,225,0) 
                takePlayerMoney(150000) 
                triggerServerEvent ("give12",getLocalPlayer(),give12) 
                else 
                guiSetVisible(GUIEditor_Window[1],false) 
                guiSetVisible(GUIEditor_Window[2],true) 
                end 
            elseif (source == GUIEditor_Button[7]) then 
                money = getPlayerMoney (source) 
                if (money >= 100000) then 
                player = getLocalPlayer() 
                outputChatBox ("You bought Night Vision! For: $100000",225,225,0) 
                takePlayerMoney(100000) 
                triggerServerEvent ("give44",getLocalPlayer(),give44) 
                else 
                guiSetVisible(GUIEditor_Window[1],false) 
                guiSetVisible(GUIEditor_Window[2],true) 
                end 
            elseif (source == GUIEditor_Button[8]) 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 == 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) 
  
  
--- --- --- --- --- 

Now For the 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 givedeagle () 
giveWeapon (source,12,1,true) 
end 
addEvent("give12",true) 
addEventHandler("give12",getRootElement(),give12) 
  
  
function give44 () 
setWeaponProperty (source,44,1,true) 
end 
addEvent("give44",true) 
addEventHandler("give44",getRootElement(),give44) 
  
  
function give18 () 
giveWeapon (source,18,5,true) 
end 
addEvent("give18",true) 
addEventHandler("give18",getRootElement(),give18) 

If the Meta Helps here is that too!

meta> 
    <info author="Albert" name="MyScript" version="1.0.0" type="script"/> 
    <script src="Script2.lua" type="server"/> 
    <script src="Script1.lua" type="client"/> 
</meta> 

Now for the explanation; I am getting an error on the console saying "WARNING: Not Loading Resource "MyScript" As It Contains Illegal Characters!" this usually happens to like map files and stuff but they give another message, this one doesn't ... i have looked over this many times and i cant see a problem also this is my first script well, copyed alot but it was mixed about and added my own modifications to it! if you guys could help i would be pleased :D

Link to comment
Guest Guest4401
WARNING: Not Loading Resource "MyScript" As It Contains Illegal Characters!

I got that error many times only when my resource name had spaces, if your resource name has spaces then remove them.

Link to comment
WARNING: Not Loading Resource "MyScript" As It Contains Illegal Characters!

I got that error many times only when my resource name had spaces, if your resource name has spaces then remove them.

and if you have characters like !,@,#,$,%,^,&,*,(,),-,+,|,=,\ ETC...

Link to comment

try this:

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,true) 
  
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 givedeagle () 
giveWeapon (source,12,1,true) 
end 
addEvent("give12",true) 
addEventHandler("give12",getRootElement(),give12) 
  
  
function give44 () 
setWeaponProperty (source,44,1,true) 
end 
addEvent("give44",true) 
addEventHandler("give44",getRootElement(),give44) 
  
  
function give18 () 
giveWeapon (source,18,5,true) 
end 
addEvent("give18",true) 
addEventHandler("give18",getRootElement(),give18) 

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Image = {} 
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
  
        GUIEditor_Window[1] = guiCreateWindow(224,131,364,323,"Umbrella Corperation's Weapon Shop!",true) 
        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]) 
        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 Viberator: $150000",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: $1500000",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/night.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[8] = guiCreateButton(280,271,70,43,"Buy 1 Night Vision: $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) 
            
            if (source == GUIEditor_Button[1]) 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 Viberater! For: $150000",225,225,0) 
                takePlayerMoney(150000) 
                triggerServerEvent ("give12",getLocalPlayer(),give12) 
                else 
                guiSetVisible(GUIEditor_Window[1],false) 
                guiSetVisible(GUIEditor_Window[2],true) 
                end 
            elseif (source == GUIEditor_Button[7]) then 
                money = getPlayerMoney (source) 
                if (money >= 100000) then 
                player = getLocalPlayer() 
                outputChatBox ("You bought Night Vision! For: $100000",225,225,0) 
                takePlayerMoney(100000) 
                triggerServerEvent ("give44",getLocalPlayer(),give44) 
                else 
                guiSetVisible(GUIEditor_Window[1],false) 
                guiSetVisible(GUIEditor_Window[2],true) 
                end 
            elseif (source == GUIEditor_Button[8]) 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 == button) then 
                guiSetVisible(GUIEditor_Window[2],false) 
                guiSetVisible(GUIEditor_Window[1],true) 
          
         end 
    end 
end) 
        
function showGUI () 
guiSetVisible (GUIEditor_Window[1],true) 
showCursor (true) 
end 
addEvent ("showGUI",true) 
addEventHandler ("showGUI",getRootElement(),showGUI) 

Link to comment
Guest Guest4401

You forgot to close the onClientGUIClick event with close bracket and also forgot to end an if check.

Try this

  
--- --- --- --- --- 
  
-- 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!",true) 
        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]) 
        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 Viberator: $150000",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: $1500000",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/night.png",false,GUIEditor_Window[1]) 
        GUIEditor_Button[8] = guiCreateButton(280,271,70,43,"Buy 1 Night Vision: $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[1]) 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 Viberater! For: $150000",225,225,0) 
            takePlayerMoney(150000) 
            triggerServerEvent ("give12",getLocalPlayer(),give12) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[7]) then 
            money = getPlayerMoney (source) 
            if (money >= 100000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought Night Vision! For: $100000",225,225,0) 
            takePlayerMoney(100000) 
            triggerServerEvent ("give44",getLocalPlayer(),give44) 
            else 
            guiSetVisible(GUIEditor_Window[1],false) 
            guiSetVisible(GUIEditor_Window[2],true) 
            end 
        elseif (source == GUIEditor_Button[8]) 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 == 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) 
  
  
--- --- --- --- --- 

Link to comment
Guest Guest4401
Ok when i start the Resource it poped up with part of the gui "You Do Not Have Enought For That Weapon" also wheni walk into the marker the window doesent show but the cursor appears :/ Thanks though :D

Error 1: you have set absolute positions for relative.

Change

GUIEditor_Window[1] = guiCreateWindow(224,131,364,323,"Umbrella Corperation's Weapon Shop!",true) 

to

GUIEditor_Window[1] = guiCreateWindow(224,131,364,323,"Umbrella Corperation's Weapon Shop!",false) 

Error 2: you forgot to hide unnecessary windows when resource starts

Also add,

guiSetVisible(GUIEditor_Window[2], false) 

in the onClientResourceStart event after it creates the 'you don't have enough money' window. This will hide the 'you dont have enough money' window when the resource starts.

Error 3: function name is wrong

Change

function givedeagle () 
giveWeapon (source,12,1,true) 
end 
addEvent("give12",true) 
addEventHandler("give12",getRootElement(),give12) 

to

function give12 () 
giveWeapon (source,12,1,true) 
end 
addEvent("give12",true) 
addEventHandler("give12",getRootElement(),give12) 

Link to comment

Okay :D Progress is starting to gain, The Exit Button doesent do anything but the Buy Dildo Large button makes you Exit :L also, the Buy Cocktail button makes you buy a Night Vision and the Night Vision buttone makes you buy a Cocktail xD but the other 2 buttons are working, also when i get to the login window the both Gui windows pop up "Not Enough Cash" And the Actual shop :/

EDIT i see the corrections now

Link to comment

You know that the wiki is there for a reason?

69: WEAPONTYPE_PISTOL_SKILL

70: WEAPONTYPE_PISTOL_SILENCED_SKILL

71: WEAPONTYPE_DESERT_EAGLE_SKILL

72: WEAPONTYPE_SHOTGUN_SKILL

73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL

74: WEAPONTYPE_SPAS12_SHOTGUN_SKILL

75: WEAPONTYPE_MICRO_UZI_SKILL

76: WEAPONTYPE_MP5_SKILL

77: WEAPONTYPE_AK47_SKILL

78: WEAPONTYPE_M4_SKILL

79: WEAPONTYPE_SNIPERRIFLE_SKILL

Link to comment

Okay as you were probably expecting i am back, with the setPedStat Ability i am able to click and buy it in the GUI, but, i do not get me 999 stat to make the weapons dual here is the codes containing the setPedStat;

  
function setPedStat75 () 
setPedStat (source,75,999,true) 
end 
addEvent("setPedStat75",true) 
addEventHandler("seTPedStat75",getRootElement(),setPedStat75) 
  
  
  
function setPedStat73 () 
setPedStat (source,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) 

That is the server side now for the Client;

        elseif (source == GUIEditor_Button[5]) then 
            money = getPlayerMoney (source) 
            if (money >= 1000000) then 
            player = getLocalPlayer() 
            outputChatBox ("You bought Dual Uzi Skill For: $1000000",225,225,0) 
            takePlayerMoney(1000000) 
            triggerServerEvent ("setPedStat75",getLocalPlayer(),setPedStat75) 
            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 
            player = getLocalPlayer() 
            outputChatBox ("You bought Dual Pistol Skill For: $500000",225,225,0) 
            takePlayerMoney(500000) 
            triggerServerEvent ("setPedStat69",getLocalPlayer(),setPedStat69) 
            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 
            player = getLocalPlayer() 
            outputChatBox ("You bought Dual Sawn Off Skill For: $750000",225,225,0) 
            takePlayerMoney(750000) 
            triggerServerEvent ("setPedStat73",getLocalPlayer(),setPedStat73) 
            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 

Sorry for being a pain but this si my first custom script i have been through the tutorials :/

Link to comment

try this:

Client-side

        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 

Server-side

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) 

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...