Jump to content

[Error]Script


Recommended Posts

I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons which is the problem?

local markers = {} 
  
function consoleCreateMarker ( thePlayer, commandName ) 
    if not markers [ thePlayer ] then 
        local x, y, z = getElementPosition ( thePlayer ) 
        markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
        if ( markers [ thePlayer ] ) then 
            setElementData(markers [ thePlayer ], "markerType", "WeaponShop") 
            setElementFrozen( thePlayer, true ) 
            outputConsole ( "Marker created successfully", thePlayer ) 
        else 
            outputConsole ( "Failed to create marker", thePlayer ) 
        end 
    else 
        outputChatBox ( "You're selling already.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "sell", consoleCreateMarker, false, false ) 
  
  
function para( thePlayer, commandName ) 
    if markers [ thePlayer ] then 
        setElementFrozen( thePlayer, false ) 
        destroyElement( markers [ thePlayer ] ) 
        markers [ thePlayer ] = nil 
    else 
        outputChatBox ( "You haven't started selling yet.", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("stopsell", para, false, false) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaAA ( thePlayer ) 
if ( getPlayerMoney(source) >= 2000 ) then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 31, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaAA", true ) 
addEventHandler( "armaAA", getRootElement(), armaAA ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaBB ( thePlayer ) 
if ( getPlayerMoney(source) >= 2000 ) then 
   takePlayerMoney ( source, 2000 ) 
    giveWeapon ( source, 30, 100 ) 
    givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaBB", true ) 
addEventHandler( "armaBB", getRootElement(), armaBB ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaCC ( thePlayer ) 
if ( getPlayerMoney(source) >= 4000 ) then   
   takePlayerMoney ( source, 4000 ) 
   giveWeapon ( source, 34, 30 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaCC", true ) 
addEventHandler( "armaCC", getRootElement(), armaCC ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaDD ( thePlayer ) 
if ( getPlayerMoney(source) >= 500 ) then 
   takePlayerMoney ( source, 500 ) 
   giveWeapon ( source, 16, 1 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaDD", true ) 
addEventHandler( "armaDD", getRootElement(), armaDD ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaEE( thePlayer ) 
if ( getPlayerMoney(source) >= 200 ) then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 32, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaEE", true ) 
addEventHandler( "armaEE", getRootElement(), armaEE ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaFF( thePlayer ) 
if ( getPlayerMoney(source) >= 200 ) then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 28, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaFF", true ) 
addEventHandler( "armaFF", getRootElement(), armaFF ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaGG( thePlayer ) 
if ( getPlayerMoney(source) >= 200 ) then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 26, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaGG", true ) 
addEventHandler( "armaGG", getRootElement(), armaGG ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
  
function armaHH( thePlayer ) 
if ( getPlayerMoney(source) >= 200 ) then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 23, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaHH", true ) 
addEventHandler( "armaHH", getRootElement(), armaHH ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaII( thePlayer ) 
if ( getPlayerMoney(source) >= 2000 ) then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 24, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaII", true ) 
addEventHandler( "armaII", getRootElement(), armaII ) 

Link to comment

Try this:

local markers = {} 
  
function consoleCreateMarker ( thePlayer, commandName ) 
    if not markers [ thePlayer ] then 
        local x, y, z = getElementPosition ( thePlayer ) 
        markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
        if ( markers [ thePlayer ] ) then 
            setElementData(markers [ thePlayer ], "markerType", "WeaponShop") 
            setElementFrozen( thePlayer, true ) 
            outputConsole ( "Marker created successfully", thePlayer ) 
        else 
            outputConsole ( "Failed to create marker", thePlayer ) 
        end 
    else 
        outputChatBox ( "You're selling already.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "sell", consoleCreateMarker, false, false ) 
  
  
function para( thePlayer, commandName ) 
    if markers [ thePlayer ] then 
        setElementFrozen( thePlayer, false ) 
        destroyElement( markers [ thePlayer ] ) 
        markers [ thePlayer ] = nil 
    else 
        outputChatBox ( "You haven't started selling yet.", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("stopsell", para, false, false) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaAA ( thePlayer ) 
if getPlayerMoney(source) >= 2000  then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 31, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaAA", true ) 
addEventHandler( "armaAA", getRootElement(), armaAA ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaBB ( thePlayer ) 
if getPlayerMoney(source) >= 2000  then 
   takePlayerMoney ( source, 2000 ) 
    giveWeapon ( source, 30, 100 ) 
    givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaBB", true ) 
addEventHandler( "armaBB", getRootElement(), armaBB ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaCC ( thePlayer ) 
if getPlayerMoney(source) >= 4000 then   
   takePlayerMoney ( source, 4000 ) 
   giveWeapon ( source, 34, 30 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaCC", true ) 
addEventHandler( "armaCC", getRootElement(), armaCC ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaDD ( thePlayer ) 
if getPlayerMoney(source) >= 500  then 
   takePlayerMoney ( source, 500 ) 
   giveWeapon ( source, 16, 1 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaDD", true ) 
addEventHandler( "armaDD", getRootElement(), armaDD ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaEE( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 32, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaEE", true ) 
addEventHandler( "armaEE", getRootElement(), armaEE ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaFF( thePlayer ) 
if getPlayerMoney(source) >= 200  then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 28, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaFF", true ) 
addEventHandler( "armaFF", getRootElement(), armaFF ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaGG( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 26, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaGG", true ) 
addEventHandler( "armaGG", getRootElement(), armaGG ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
  
function armaHH( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 23, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaHH", true ) 
addEventHandler( "armaHH", getRootElement(), armaHH ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaII( thePlayer ) 
if getPlayerMoney(source) >= 2000 then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 24, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaII", true ) 
addEventHandler( "armaII", getRootElement(), armaII ) 

Link to comment
Try this:
local markers = {} 
  
function consoleCreateMarker ( thePlayer, commandName ) 
    if not markers [ thePlayer ] then 
        local x, y, z = getElementPosition ( thePlayer ) 
        markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
        if ( markers [ thePlayer ] ) then 
            setElementData(markers [ thePlayer ], "markerType", "WeaponShop") 
            setElementFrozen( thePlayer, true ) 
            outputConsole ( "Marker created successfully", thePlayer ) 
        else 
            outputConsole ( "Failed to create marker", thePlayer ) 
        end 
    else 
        outputChatBox ( "You're selling already.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "sell", consoleCreateMarker, false, false ) 
  
  
function para( thePlayer, commandName ) 
    if markers [ thePlayer ] then 
        setElementFrozen( thePlayer, false ) 
        destroyElement( markers [ thePlayer ] ) 
        markers [ thePlayer ] = nil 
    else 
        outputChatBox ( "You haven't started selling yet.", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("stopsell", para, false, false) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaAA ( thePlayer ) 
if getPlayerMoney(source) >= 2000  then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 31, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaAA", true ) 
addEventHandler( "armaAA", getRootElement(), armaAA ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaBB ( thePlayer ) 
if getPlayerMoney(source) >= 2000  then 
   takePlayerMoney ( source, 2000 ) 
    giveWeapon ( source, 30, 100 ) 
    givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaBB", true ) 
addEventHandler( "armaBB", getRootElement(), armaBB ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaCC ( thePlayer ) 
if getPlayerMoney(source) >= 4000 then   
   takePlayerMoney ( source, 4000 ) 
   giveWeapon ( source, 34, 30 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaCC", true ) 
addEventHandler( "armaCC", getRootElement(), armaCC ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaDD ( thePlayer ) 
if getPlayerMoney(source) >= 500  then 
   takePlayerMoney ( source, 500 ) 
   giveWeapon ( source, 16, 1 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaDD", true ) 
addEventHandler( "armaDD", getRootElement(), armaDD ) 
  
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaEE( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 32, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaEE", true ) 
addEventHandler( "armaEE", getRootElement(), armaEE ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaFF( thePlayer ) 
if getPlayerMoney(source) >= 200  then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 28, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaFF", true ) 
addEventHandler( "armaFF", getRootElement(), armaFF ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
function armaGG( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 26, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaGG", true ) 
addEventHandler( "armaGG", getRootElement(), armaGG ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
  
  
function armaHH( thePlayer ) 
if getPlayerMoney(source) >= 200 then 
   takePlayerMoney ( source, 200 ) 
   giveWeapon ( source, 23, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaHH", true ) 
addEventHandler( "armaHH", getRootElement(), armaHH ) 
--------------------------------------------------------------------------------------------------------------------------------------- 
function armaII( thePlayer ) 
if getPlayerMoney(source) >= 2000 then 
   takePlayerMoney ( source, 2000 ) 
   giveWeapon ( source, 24, 50 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
addEvent( "armaII", true ) 
addEventHandler( "armaII", getRootElement(), armaII ) 

Not working

Link to comment
I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons.

@HyPeX Apparently, when someone buy weapons from the dealer, hes wants to give the dealer the money, but it's not working .. he already said what the problem is.

Link to comment
I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons.

@HyPeX Apparently, when someone buy weapons from the dealer, hes wants to give the dealer the money, but it's not working .. he already said what the problem is.

local inMarker 
  
addEventHandler("onClientMarkerLeave", resourceRoot, function( hitElement ) 
    if not hitElement == localPlayer then return end 
    inMarker = nil 
end) 
  
addEventHandler("onClientMarkerLeave", resourceRoot, function( hitElement ) 
    if not hitElement == localPlayer then return end 
    inMarker = source 
end) 
  
addEventHandler("onClientMarkerHit", resourceRoot, function( hitElement ) 
    local markerType = getElementData(source, "markerType") 
    if hitElement == localPlayer and markerType and markerType == "WeaponShop" then 
        panel = guiCreateWindow(510, 197, 352, 396, "Arms Dealer", false) 
        guiWindowSetSizable(panel, false) 
        armaA = guiCreateButton(10, 28, 129, 30, "M4", false, panel) 
        armaB = guiCreateButton(10, 68, 129, 30, "AK-47", false, panel) 
        armaC = guiCreateButton(10, 108, 129, 30, "Sniper", false, panel) 
        armaD = guiCreateButton(10, 148, 129, 30, "Grenade", false, panel) 
        armaE = guiCreateButton(10, 188, 129, 30, "Tec-9", false, panel) 
        armaF = guiCreateButton(10, 228, 129, 30, "Uzi", false, panel) 
        armaG = guiCreateButton(10, 268, 129, 30, "Sawn-Off", false, panel) 
        armaH = guiCreateButton(10, 308, 129, 30, "Silenced", false, panel) 
        armaI = guiCreateButton(10, 348, 129, 30, "Deagle", false, panel) 
        cerrar = guiCreateButton(166, 25, 169, 352, "Close", false, panel) 
        guiSetFont(cerrar, "sa-gothic")     
         
        showCursor (true) 
        addEventHandler ("onClientGUIClick", armaA, armaAA, false) 
        addEventHandler ("onClientGUIClick", armaB, armaBB, false) 
        addEventHandler ("onClientGUIClick", armaC, armaCC, false) 
        addEventHandler ("onClientGUIClick", armaD, armaDD, false) 
        addEventHandler ("onClientGUIClick", armaE, armaEE, false) 
        addEventHandler ("onClientGUIClick", armaF, armaFF, false) 
        addEventHandler ("onClientGUIClick", armaG, armaGG, false) 
        addEventHandler ("onClientGUIClick", armaH, armaHH, false) 
        addEventHandler ("onClientGUIClick", armaI, armaII, false) 
        addEventHandler ("onClientGUIClick", cerrar, cerrarr, false) 
    end 
end) 
  
  
function para ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
    triggerServerEvent ( "onPlayerWasted", localPlayer)  
end 
  
function para ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
end 
  
  
function cerrarr ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
end 
  
function armaAA ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaAA", localPlayer ) 
end 
  
function armaBB ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaBB", localPlayer ) 
end 
  
function armaCC ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaCC", localPlayer ) 
end 
function armaDD ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaDD", localPlayer ) 
end 
  
function armaEE ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaEE", localPlayer ) 
end 
  
function armaDD ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaDD", localPlayer ) 
end 
  
function armaFF ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaFF", localPlayer ) 
end 
  
function armaGG ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaGG", localPlayer ) 
end 
  
function armaHH ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaHH", localPlayer ) 
end 
  
function armaII ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaII", localPlayer ) 
end 
  
  
  
  

Link to comment
I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons.

@HyPeX Apparently, when someone buy weapons from the dealer, hes wants to give the dealer the money, but it's not working .. he already said what the problem is.

local inMarker 
  
addEventHandler("onClientMarkerLeave", resourceRoot, function( hitElement ) 
    if not hitElement == localPlayer then return end 
    inMarker = nil 
end) 
  
addEventHandler("onClientMarkerLeave", resourceRoot, function( hitElement ) 
    if not hitElement == localPlayer then return end 
    inMarker = source 
end) 
  
addEventHandler("onClientMarkerHit", resourceRoot, function( hitElement ) 
    local markerType = getElementData(source, "markerType") 
    if hitElement == localPlayer and markerType and markerType == "WeaponShop" then 
        panel = guiCreateWindow(510, 197, 352, 396, "Arms Dealer", false) 
        guiWindowSetSizable(panel, false) 
        armaA = guiCreateButton(10, 28, 129, 30, "M4", false, panel) 
        armaB = guiCreateButton(10, 68, 129, 30, "AK-47", false, panel) 
        armaC = guiCreateButton(10, 108, 129, 30, "Sniper", false, panel) 
        armaD = guiCreateButton(10, 148, 129, 30, "Grenade", false, panel) 
        armaE = guiCreateButton(10, 188, 129, 30, "Tec-9", false, panel) 
        armaF = guiCreateButton(10, 228, 129, 30, "Uzi", false, panel) 
        armaG = guiCreateButton(10, 268, 129, 30, "Sawn-Off", false, panel) 
        armaH = guiCreateButton(10, 308, 129, 30, "Silenced", false, panel) 
        armaI = guiCreateButton(10, 348, 129, 30, "Deagle", false, panel) 
        cerrar = guiCreateButton(166, 25, 169, 352, "Close", false, panel) 
        guiSetFont(cerrar, "sa-gothic")     
         
        showCursor (true) 
        addEventHandler ("onClientGUIClick", armaA, armaAA, false) 
        addEventHandler ("onClientGUIClick", armaB, armaBB, false) 
        addEventHandler ("onClientGUIClick", armaC, armaCC, false) 
        addEventHandler ("onClientGUIClick", armaD, armaDD, false) 
        addEventHandler ("onClientGUIClick", armaE, armaEE, false) 
        addEventHandler ("onClientGUIClick", armaF, armaFF, false) 
        addEventHandler ("onClientGUIClick", armaG, armaGG, false) 
        addEventHandler ("onClientGUIClick", armaH, armaHH, false) 
        addEventHandler ("onClientGUIClick", armaI, armaII, false) 
        addEventHandler ("onClientGUIClick", cerrar, cerrarr, false) 
    end 
end) 
  
  
function para ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
    triggerServerEvent ( "onPlayerWasted", localPlayer)  
end 
  
function para ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
end 
  
  
function cerrarr ( hitElement ) 
    showCursor ( false ) 
    guiSetVisible (panel, false ) 
end 
  
function armaAA ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaAA", localPlayer ) 
end 
  
function armaBB ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaBB", localPlayer ) 
end 
  
function armaCC ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaCC", localPlayer ) 
end 
function armaDD ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaDD", localPlayer ) 
end 
  
function armaEE ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaEE", localPlayer ) 
end 
  
function armaDD ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaDD", localPlayer ) 
end 
  
function armaFF ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaFF", localPlayer ) 
end 
  
function armaGG ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaGG", localPlayer ) 
end 
  
function armaHH ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaHH", localPlayer ) 
end 
  
function armaII ( hitElement ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaII", localPlayer ) 
end 
  
  
  
  

Link to comment

I'll help you with armaAA and you just do the same for the others

NOT TESTED

Client:

function armaAA ( thePlayer, hitElement  ) 
    showCursor ( true ) 
    triggerServerEvent ( "armaAA", thePlayer, thePlayer, hitElement ) 
end 

Server:

function armaAA ( thePlayer,hitElement ) 
if ( thePlayer == source ) then 
if ( getPlayerMoney(hitElement) >= 2000 ) then 
   takePlayerMoney ( hitElement, 2000 ) 
   giveWeapon ( hitElement, 31, 100 ) 
   givePlayerMoney (thePlayer, 10000) 
end 
end 
end 
addEvent( "armaAA", true ) 
addEventHandler( "armaAA", getRootElement(), armaAA ) 

Edited by Guest
Link to comment
  • Moderators

The first argument after the string event("armaAA"), will be the source.

triggerServerEvent ( "armaAA", theDealer, theDealer, hitElement ) 

triggerServerEvent ( string event, [color=#FF0000]element theElement[/color], [arguments...] ) 

Is the source.

The rest will be the arguments > (argument1,argumen2)

Edited by Guest
Link to comment
I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons.

@HyPeX Apparently, when someone buy weapons from the dealer, hes wants to give the dealer the money, but it's not working .. he already said what the problem is.

Thats not a problem, thats a want, basic bussiness/economics..

PD: As far as i read, hitElement is a gui button...

Also, you should add some outputchatbox in the chain to check wether they're working, and then if they are what you want.

Link to comment
I got two persons a person that Buys weapons and the other that sells them i want givePlayerMoney to give The dealer money when someone buys him Weapons.

@HyPeX Apparently, when someone buy weapons from the dealer, hes wants to give the dealer the money, but it's not working .. he already said what the problem is.

Thats not a problem, thats a want, basic bussiness/economics..

PD: As far as i read, hitElement is a gui button...

Also, you should add some outputchatbox in the chain to check wether they're working, and then if they are what you want.

Negative, hitElement is a Player that hits the Marker

Link to comment

No. Read the event, thats the button state, you're triggering this with onClientGUIClick.

Read a little:

https://wiki.multitheftauto.com/wiki/OnClientGUIClick

  
        addEventHandler ("onClientGUIClick", armaA, armaAA, false) 
        addEventHandler ("onClientGUIClick", armaB, armaBB, false) 
        addEventHandler ("onClientGUIClick", armaC, armaCC, false) 
        addEventHandler ("onClientGUIClick", armaD, armaDD, false) 
        addEventHandler ("onClientGUIClick", armaE, armaEE, false) 
        addEventHandler ("onClientGUIClick", armaF, armaFF, false) 
        addEventHandler ("onClientGUIClick", armaG, armaGG, false) 
        addEventHandler ("onClientGUIClick", armaH, armaHH, false) 
        addEventHandler ("onClientGUIClick", armaI, armaII, false) 
        addEventHandler ("onClientGUIClick", cerrar, cerrarr, false) 
  

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