Jump to content

triggerServerEvent problem


rafull6

Recommended Posts

Guys, help me, please, correct my code. I tried to fix it for an hour with noi results :( I have triggerServerEvent problem. Debugscript going crazy with all mistakes!

Here is my code:

debugscript errors:

http://s017.radikal.ru/i427/1202/e8/9a0d3f560680.jpg

Serverside:

----- pilot ------- 
function pilotjob ( thePlayer ) 
if (getPlayerNametagText (thePlayer) == "[COP]" .. getPlayerName (thePlayer)) then 
    setPlayerNametagText (thePlayer, getPlayerName (thePlayer)) 
end 
  setPedSkin ( thePlayer, 61 ) 
  takeWeapon (thePlayer, 14) 
  takeWeapon (thePlayer, 23) 
  takeWeapon (thePlayer, 3) 
  setPlayerTeam ( thePlayer, teampilot ) 
  setPlayerNametagColor (thePlayer, 148, 0, 211 ) 
  --takeAllWeapons ( thePlayer ) 
  setPedArmor ( thePlayer, 0 ) 
end 
addEvent("pilotJobx", true) 
addEventHandler("pilotJobx", getRootElement(), pilotjob) 
--------------------- 

Clientside:

  
pilotmark=createMarker(1953.82,-2177.61,12.65,"cylinder",1,148,0,211,70) 
  
addEventHandler( "onClientMarkerHit",pilotmark, 
    function( hitElement, matchingDimension ) 
        if hitElement == localPlayer then 
            showCursor( true ) 
            xWindow = guiCreateWindow(0.3184,0.2568,0.2500,0.356,"",true) 
            buttonYes = guiCreateButton(0.03,0.86,0.45,0.10,"yes!",true,xWindow) 
            buttonNo = guiCreateButton(0.505,0.86,0.45,0.10,"no",true,xWindow) 
            --guiCreateStaticImage (0.05, 0.2, 0.9, 0.5,"/bankrob.png",true,xWindow) 
            addEventHandler ( "onClientGUIClick", buttonYes, 
                function(  ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                    triggerServerEvent( "pilotJobx", root) --triggerServerEvent("ServerPlaySoundRobbery",localPlayer) 
                    ---outputChatBox( "`Вы захватили банк вы должны продержаться 5 минут.",255,0,0 )   
                end 
            ,false ) 
                
            addEventHandler ( "onClientGUIClick", buttonNo, 
                function ( ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                end 
            ,false ) 
        end 
    end 
) 
  

Link to comment
  
  
pilotmark=createMarker(1953.82,-2177.61,12.65,"cylinder",1,148,0,211,70) 
  
addEventHandler( "onClientMarkerHit",pilotmark, 
    function( hitElement, matchingDimension ) 
        if hitElement == localPlayer then 
            showCursor( true ) 
            xWindow = guiCreateWindow(0.3184,0.2568,0.2500,0.356,"",true) 
            buttonYes = guiCreateButton(0.03,0.86,0.45,0.10,"yes!",true,xWindow) 
            buttonNo = guiCreateButton(0.505,0.86,0.45,0.10,"no",true,xWindow) 
            --guiCreateStaticImage (0.05, 0.2, 0.9, 0.5,"/bankrob.png",true,xWindow) 
            addEventHandler ( "onClientGUIClick", buttonYes, 
                function(  ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                    triggerServerEvent( "pilotJobx", localPlayer, localPlayer) --triggerServerEvent("ServerPlaySoundRobbery",localPlayer) 
                    ---outputChatBox( "`Вы захватили банк вы должны продержаться 5 минут.",255,0,0 )   
                end 
            ,false ) 
                
            addEventHandler ( "onClientGUIClick", buttonNo, 
                function ( ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                end 
            ,false ) 
        end 
    end 
) 
  
  

Try it

Link to comment

Server

addEvent( "pilotJobx", true ) 
  
----- pilot ------- 
function pilotjob ( ) 
    if getPlayerNametagText ( source ) == "[COP]" then 
        setPlayerNametagText ( source, getPlayerName ( source ) ) 
    end 
    setElementModel ( source, 61 ) 
    takeWeapon ( source, 14 ) 
    takeWeapon ( source, 23 ) 
    takeWeapon ( source, 3 ) 
    setPlayerTeam ( source, teampilot ) 
    setPlayerNametagColor ( source, 148, 0, 211 ) 
    --takeAllWeapons ( thePlayer ) 
    setPedArmor ( source, 0 ) 
end 
addEventHandler( "pilotJobx", root, pilotjob ) 
  

Client

pilotmark = createMarker( 1953.82,-2177.61,12.65,"cylinder",1,148,0,211,70 ) 
xWindow = guiCreateWindow( 0.3184,0.2568,0.2500,0.356,"",true ) 
buttonYes = guiCreateButton( 0.03,0.86,0.45,0.10,"yes!",true,xWindow ) 
buttonNo = guiCreateButton( 0.505,0.86,0.45,0.10,"no",true,xWindow ) 
guiSetVisible( xWindow,false ) 
  
addEventHandler( "onClientMarkerHit",pilotmark, 
    function( hitElement, matchingDimension ) 
        if hitElement == localPlayer then 
            showCursor( true ) 
            guiSetVisible( xWindow,not guiGetVisible( xWindow ) ) 
            --guiCreateStaticImage (0.05, 0.2, 0.9, 0.5,"/bankrob.png",true,xWindow) 
            addEventHandler ( "onClientGUIClick", buttonYes, 
                function(  ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                    triggerServerEvent( "pilotJobx", localPlayer ) --triggerServerEvent("ServerPlaySoundRobbery",localPlayer) 
                    ---outputChatBox( "`Вы захватили банк вы должны продержаться 5 минут.",255,0,0 )   
                end 
            ,false ) 
            addEventHandler ( "onClientGUIClick", buttonNo, 
                function ( ) 
                    showCursor( false ) 
                    guiSetVisible( xWindow,false ) 
                end 
            ,false ) 
        end 
    end 
) 

Updated.

Variable teampilot is defined?

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