Jump to content

Not Working


yMassai

Recommended Posts

Posted (edited)
--Create Stuff 
  
function testCreateTrainStuff() 
    test_marker_request = createMarker( 1543.98962, -1670.46398, 12.55753 , "cylinder", 1.5, 255, 0, 0, 170) 
    createBlip ( 1543.98962, -1670.46398, 13.55753 , 41) 
                    createPed (280,1543.98962,-1670.46398,13.55753, 5.0) 
setElementFrozen ( ped, true ) 
  
end 
addEventHandler  
("onResourceStart",getResourceRootElement(getThisResource()),testCreateTestStuff) 
  
--Create Vehicle 
  
function testCreateTest () 
    theTest = createVehicle (596, 1535.05615, -1675.60766, 12.96008) 
    outputChatBox ("Você virou Policial",source, 255, 00, 00) 
end 
addEvent ("testCreateTest",true) 
addEventHandler ("testCreateTest",getRootElement(),testCreateTest) 
  
--Test Gui 
  
function testCreateTestGUI(hitElement) 
    if source == test_marker_request then 
        triggerClientEvent (hitElement,"testCreateTestGUI",getRootElement()) 
    end 
end 
addEventHandler ("onMarkerHit",getRootElement(),testCreateTestGUI) 

this feature is not working could anyone help me?

would also have put to take a team and a skin?

this test_s

Edited by Guest
Posted (edited)
--Create GUI 
  
function testCreateTestGUI() 
test_window_main = guiCreateWindow (0.3,0.2,0.4,0.5,"Train Mission",true) 
memo1 = guiCreateMemo (0.15,0.2,0.7,0.5,"Nothing",true,test_window_main) 
    test_window_main_button_acceitar = guiCreateButton(0.52,0.85,0.45,0.1,"Aceitar",true,train_window_main) 
    test_window_main_button_sair = guiCreateButton(0,0.85,0.45,0.1,"Sair",true,test_window_main) 
    showCursor (true) 
end 
addEvent ("testCreateTestGUI",true) 
addEventHandler ("testCreateTestGUI",getResourceRootElement(getThisResource()),testCreateTestGUI) 
  
--On test Window Click 
  
function testOntestWindowClick() 
   if source == test_window_main_button_aceitar then 
        triggerServerEvent ("testCreateTest",getRootElement()) 
        testDestroyTestGUI () 
   elseif source == test_window_main_button_sair then 
        testDestroyTestGUI () 
    end 
end 
addEventHandler("onClientGUIClick",getRootElement(),testOnTestWindowClick) 

these are the data of window.

this test_c

Edited by Guest
Posted

script error: test\test_s.lua:10: ambiguous syntax (function call x new statement) near '('

warning: loading script failid: test\test_s:10: ambiguous syntax (function call x new statement) near '('

that appears in the console window

Posted

-- client side:

--Create GUI 
function testCreateTestGUI ( ) 
    test_window_main = guiCreateWindow (0.3,0.2,0.4,0.5,"Train Mission",true) 
    memo1 = guiCreateMemo (0.15,0.2,0.7,0.5,"Nothing",true,test_window_main) 
    test_window_main_button_acceitar = guiCreateButton(0.52,0.85,0.45,0.1,"Aceitar",true,test_window_main) 
    test_window_main_button_sair = guiCreateButton(0,0.85,0.45,0.1,"Sair",true,test_window_main) 
    showCursor ( true ) 
end 
addEvent ( "testCreateTestGUI", true ) 
addEventHandler ( "testCreateTestGUI", root, testCreateTestGUI ) 
  
--Destroy GUI 
function testDestroyTestGUI ( ) 
    if isElement ( test_window_main ) then 
        destroyElement ( test_window_main ) 
    end 
    if isElement ( memo1 ) then 
        destroyElement ( memo1 ) 
    end 
    if isElement ( test_window_main_button_acceitar ) then 
        destroyElement ( test_window_main_button_acceitar ) 
    end 
    if isElement ( test_window_main_button_sair ) then 
        destroyElement ( test_window_main_button_sair ) 
    end 
    showCursor ( false ) 
end 
  
--On test Window Click 
function testOnTestWindowClick ( ) 
   if ( source == test_window_main_button_acceitar ) then 
        triggerServerEvent ( "testCreateTest", localPlayer ) 
        testDestroyTestGUI ( ) 
   elseif ( source == test_window_main_button_sair ) then 
        testDestroyTestGUI ( ) 
    end 
end 
addEventHandler ( "onClientGUIClick", root, testOnTestWindowClick ) 

-- server side:

--Create Stuff 
function testCreateTrainStuff ( ) 
    test_marker_request = createMarker( 1543.98962, -1670.46398, 12.55753, "cylinder", 1.5, 255, 0, 0, 170) 
    createBlip ( 1543.98962, -1670.46398, 13.55753, 41) 
    ped = createPed (280,1543.98962,-1670.46398,13.55753, 5.0) 
    setElementFrozen ( ped, true ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, testCreateTrainStuff ) 
  
--Create Vehicle 
function testCreateTest ( ) 
    theTest = createVehicle ( 596, 1535.05615, -1675.60766, 12.96008 ) 
    outputChatBox ("Você virou Policial", source, 255, 0, 0 ) 
end 
addEvent ( "testCreateTest", true ) 
addEventHandler ( "testCreateTest", root, testCreateTest ) 
  
--Test Gui 
function testCreateTestGUI ( hitElement ) 
    if ( source == test_marker_request ) then 
        triggerClientEvent ( hitElement, "testCreateTestGUI", hitElement ) 
    end 
end 
addEventHandler ( "onMarkerHit", root, testCreateTestGUI ) 

Posted

someone could help fix the bug of the car?

This script creates more of a car, could you create only one to each player?

could be introduced to get the skin 280 and the Police team?

Posted

-- server side:

local policeCars = { } -- We create a table. 
  
--Create Stuff 
function testCreateTrainStuff ( ) 
    test_marker_request = createMarker( 1543.98962, -1670.46398, 12.55753, "cylinder", 1.5, 255, 0, 0, 170) 
    createBlip ( 1543.98962, -1670.46398, 13.55753, 41) 
    ped = createPed (280,1543.98962,-1670.46398,13.55753, 5.0) 
    setElementFrozen ( ped, true ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, testCreateTrainStuff ) 
  
--Create Vehicle 
function testCreateTest ( ) 
    if ( isElement ( policeCars[ source ] ) ) then -- We check if the player already has a car spawned. 
        destroyElement ( policeCars[ source ] ) -- If so, we destroy it. 
    end 
    policeCars[ source ] = createVehicle ( 596, 1535.05615, -1675.60766, 12.96008 ) -- We create the vehicle stored in 'policeCars' table. 
    outputChatBox ("Você virou Policial", source, 255, 0, 0 ) 
end 
addEvent ( "testCreateTest", true ) 
addEventHandler ( "testCreateTest", root, testCreateTest ) 
  
--Test Gui 
function testCreateTestGUI ( hitElement ) 
    if ( source == test_marker_request ) then 
        triggerClientEvent ( hitElement, "testCreateTestGUI", hitElement ) 
    end 
end 
addEventHandler ( "onMarkerHit", root, testCreateTestGUI ) 

Posted
someone could help fix the bug of the car?

This script creates more of a car, could you create only one to each player?

could be introduced to get the skin 280 and the Police team?

You need to learn to fix everything themselves.

Posted (edited)
addEventHandler ( 'onMarkerHit', root, 
    function ( sPed ) 
        if (    source == sMarker  
            and  
                getPlayerTeam ( sPed )  
            and  
                getTeamName ( getPlayerTeam ( sPed ) ) == 'Team 1'  
            and  
                getElementModel ( sPed ) == 0 
            ) 
        then 
            outputChatBox ( 'Awesome.' ); 
        end 
    end 
) 

Edited by Guest
Posted (edited)

Function

print 

disabled in mta.

Also

getPlayerTeam ( player ) == 'Team 1' 

it's wrong because getPlayerTeam return team element ( not string ).

So correct

addEventHandler ( 'onMarkerHit', root, 
    function ( uElement ) 
        if source == myMarker and getElementType( uElement ) == 'player' then 
            local uTeam = getPlayerTeam ( uElement ) 
            if uTeam and getTeamName( uTeam ) == 'Team 1' and getElementModel ( uElement ) == 0 then 
                outputChatBox 'TODO' 
            end 
        end 
    end 
) 

Edited by Guest
Posted

local policeCars = { } -- We create a table. 
  
--Create Stuff 
function testCreateTrainStuff ( ) 
    test_marker_request = createMarker( 1543.98962, -1670.46398, 12.55753, "cylinder", 1.5, 255, 0, 0, 170) 
    createBlip ( 1543.98962, -1670.46398, 13.55753, 41) 
    ped = createPed (280,1543.98962,-1670.46398,13.55753, 90) 
    setElementFrozen ( ped, true ) 
end 
addEventHandler ( "onClientPedDamage", ped, cancelEvent ) 
addEventHandler ( "onResourceStart", resourceRoot, testCreateTestStuff ) 
  
addEventHandler ( 'onMarkerHit', root, 
    function ( uElement ) 
        if source == myMarker then 
            local uTeam = getPlayerTeam ( uElement ) 
            if uTeam and getTeamName( uTeam ) == 'Policia' and getElementModel ( player ) == 280 then 
                outputChatBox 'TODO' 
            end 
        end 
    end 
) 
  
--Create Vehicle 
function testCreateTest ( ) 
    if ( isElement ( policeCars[ source ] ) ) then -- We check if the player already has a car spawned. 
        destroyElement ( policeCars[ source ] ) -- If so, we destroy it. 
    end 
    policeCars[ source ] = createVehicle ( 596, 1535.05615, -1675.60766, 12.96008 ) -- We create the vehicle stored in 'policeCars' table. 
    outputChatBox ("Você virou Policial", source, 255, 0, 0 ) 
end 
addEvent ( "testCreateTest", true ) 
addEventHandler ( "testCreateTest", root, testCreateTest ) 
  
--Test Gui 
function testCreateTestGUI ( hitElement ) 
    if ( source == test_marker_request ) then 
        triggerClientEvent ( hitElement, "testCreateTestGUI", hitElement ) 
    end 
end 
addEventHandler ( "onMarkerHit", root, testCreateTestGUI ) 

would look like this for example?

or I put in the wrong place?

Posted
Function
print 

disabled in mta.

Also

getPlayerTeam ( player ) == 'Team 1' 

it's wrong because getPlayerTeam return team element ( not string ).

So correct

addEventHandler ( 'onMarkerHit', root, 
    function ( uElement ) 
        if source == myMarker and getElementType( uElement ) == 'player' then 
            local uTeam = getPlayerTeam ( uElement ) 
            if uTeam and getTeamName( uTeam ) == 'Team 1' and getElementModel ( uElement ) == 0 then 
                outputChatBox 'TODO' 
            end 
        end 
    end 
) 

:mrgreen: I ever forget something -.- xD

Posted (edited)
local policeCars = { } -- We create a table. 
  
--Create Stuff 
function testCreateTrainStuff ( ) 
    test_marker_request = createMarker( 1543.98962, -1670.46398, 12.55753, "cylinder", 1.5, 255, 0, 0, 170) 
    createBlip ( 1543.98962, -1670.46398, 13.55753, 41) 
    ped = createPed (280,1543.98962,-1670.46398,13.55753, 90) 
    setElementFrozen ( ped, true ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, testCreateTrainStuff ) 
addEventHandler ( "onClientPedDamage", ped, function ( ) cancelEvent ( ) end ) 
  
addEventHandler ( 'onMarkerHit', root, 
    function ( uElement ) 
        if source == myMarker then 
            local uTeam = getPlayerTeam ( uElement ) 
            if uTeam and getTeamName( uTeam ) == 'Policia' and getElementModel ( uElement ) == 280 then 
                outputChatBox 'TODO' 
            end 
        end 
    end 
) 
  
--Create Vehicle 
function testCreateTest ( ) 
    if ( isElement ( policeCars[ source ] ) ) then -- We check if the player already has a car spawned. 
        destroyElement ( policeCars[ source ] ) -- If so, we destroy it. 
    end 
    policeCars[ source ] = createVehicle ( 596, 1535.05615, -1675.60766, 12.96008 ) -- We create the vehicle stored in 'policeCars' table. 
    outputChatBox ("Você virou Policial", source, 255, 0, 0 ) 
end 
addEvent ( "testCreateTest", true ) 
addEventHandler ( "testCreateTest", root, testCreateTest ) 
  
--Test Gui 
function testCreateTestGUI ( hitElement ) 
    if ( source == test_marker_request ) then 
        triggerClientEvent ( hitElement, "testCreateTestGUI", hitElement ) 
    end 
end 
addEventHandler ( "onMarkerHit", root, testCreateTestGUI ) 

Edited by Guest

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