Jump to content

GUI An


Haze

Recommended Posts

Hello EveryOne Today i Have this script and i Try to Make The Words on the OutputChatBox Look On Small GUI Announce I use a lot of Commands and Functions but it didnt Work i dont Know why :(

Im going to Post the Code Plz Help me to Make the Words on OutputChatBox Look Us GUI Text And Thank you :)

local vehicle1 =createVehicle ( 520, 302.74, 1818.85, 17.64) 
  
ArmyVehicles  ={[vehicle1]=true} 
ArmyTeam = { ["Army"]=true } 
  
function ArmyenterVehicle ( player, seat, jacked ) 
local team = getPlayerTeam(player) 
    if ( ArmyVehicles[source] ) and ( not ArmyTeam[getTeamName ( team )] )  then 
        cancelEvent() 
        outputChatBox ( "You aren't an Army Member , you mayn't drive this.", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), ArmyenterVehicle ) 

Link to comment

use:

guiCreateLabel( float x, float y, float width, float height, "You aren't an Army Member , you mayn't drive this.", bool relative) 

this is how it should look:

local vehicle1 =createVehicle ( 520, 302.74, 1818.85, 17.64) 
  
ArmyVehicles  ={[vehicle1]=true} 
ArmyTeam = { ["Army"]=true } 
  
function ArmyenterVehicle ( player, seat, jacked ) 
local team = getPlayerTeam(player) 
    if ( ArmyVehicles[source] ) and ( not ArmyTeam[getTeamName ( team )] )  then 
        cancelEvent() 
        guiCreateLabel( float x, float y, float width, float height, "You aren't an Army Member , you mayn't drive this.", bool relative) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), ArmyenterVehicle ) 

Link to comment

HI ALL I TRY TO MAKE THIS ONE GUI THINK And its not working the An For Hydra in GUI its not working

local vehicle1 =createVehicle ( 520, 302.74, 1818.85, 17.64) 
  
ArmyVehicles  ={[vehicle1]=true} 
ArmyTeam = { ["Army"]=true } 
  
function ArmyenterVehicle ( player, seat, jacked ) 
local team = getPlayerTeam(player) 
    if ( ArmyVehicles[source] ) and ( not ArmyTeam[getTeamName ( team )] )  then 
        cancelEvent() 
        guiCreateLabel( 402, 271, 255, 47, "You aren't an Army Member , you mayn't drive this.", false) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), ArmyenterVehicle ) 

Link to comment

Firstly, use the LUA tags.

Second, guiCreateLabel is client side ONLY, and your event handler is server side, so, you need a event triggered to client.

-- server side

local vehicle1 =createVehicle ( 520, 302.74, 1818.85, 17.64) 
  
ArmyVehicles  ={[vehicle1]=true} 
ArmyTeam = { ["Army"]=true } 
  
function ArmyenterVehicle ( player, seat, jacked ) 
local team = getPlayerTeam(player) 
    if ( ArmyVehicles[source] ) and ( not ArmyTeam[getTeamName ( team )] )  then 
        triggerClientEvent(player,"showErrorLabel",player) 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), ArmyenterVehicle ) 
  

-- client side

addEvent("showErrorLabel",true) 
addEventHandler("showErrorLabel",root, 
function () 
      if errorLabel then destroyElement(errorLabel) end 
      errorLabel =  guiCreateLabel( 402, 271, 255, 47, "You aren't an Army Member , you mayn't drive this.", false) 
end) 

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