Jump to content

setElementPosition bad D:


iFoReX

Recommended Posts

why the setElementPosition is bad ?

    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
    setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "qd2", true ) 
addEventHandler( "qd2", getRootElement(), qm2 ) 
  
local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. 
function qm4 ( ) 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
     setElementPosition ( source, table[ math.random ( #table ) ] ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
                 setElementPosition ( source, table[ math.random ( #table ) ] ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "qd4", true ) 
addEventHandler( "qd4", getRootElement(), qm4 ) 
  
addEventHandler("onResourceStart",Vehiculocrear) 
  
function qm3 ( ) 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
    setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "qd3", true ) 
addEventHandler( "qd3", getRootElement(), qm3 ) 

Link to comment
Guest Guest4401

Because in your case, the 2nd argument in setElementPosition is a table. It's not unpacking the x,y,z positions as you're trying to do.

EDIT : There are a lot of other basic errors too, you must try to fix those first. (No offense)

Edited by Guest4401
Link to comment

You have

addEventHandler("onResourceStart",Vehiculocrear) 

Which triggers nothing...

EDIT:

parameters = unpack(Table) 

in your case, you use:

x,y,z = unpack(Table[math.random(#Table)]) 

try this:

addEvent( "qd2", true ) 
addEventHandler( "qd2", root,function() 
   local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
    setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end) 
  
local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. 
  
addEvent( "qd4", true ) 
addEventHandler( "qd4", root,function() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
     setElementPosition ( source, table[ math.random ( #table ) ] ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            x,y,z = unpack(table[math.random(#table)]) 
            setElementPosition ( source, x,y,z) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end) 
  
addEventHandler("onResourceStart",resourceRoot,Vehiculocrear) 
  
addEvent( "qd3", true ) 
addEventHandler( "qd3", root,function() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
    setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end) 

Link to comment

??

local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. 
function qm4 ( ) 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    if name == "ElMota[Gold]~x" then 
     setElementPosition ( source, unpack(table)table[ math.random ( #table ) ] ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
                 setElementPosition ( source, unpack(table)table[ math.random ( #table ) ] ) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end 
addEvent( "qd4", true ) 
addEventHandler( "qd4", getRootElement(), qm4 ) 

Link to comment

no, like this:

local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. 
  
addEvent( "qd4", true ) 
addEventHandler( "qd4", root,function() 
    local money = getPlayerMoney ( source ) 
    local name = getPlayerName ( source ) 
    local x,y,z = unpack(table[math.random(#table)]) 
    if name == "ElMota[Gold]~x" then 
     setElementPosition ( source,x,y,z ) 
    else 
        if ( money >= 10000 ) then 
            takePlayerMoney ( source, 10000 ) 
            setElementPosition ( source, x,y,z) 
        else 
            outputChatBox ( "No Tienes Suficiente Dinero", source ) 
        end 
    end 
end) 

Link to comment

I want when theKiller had 6 stars in wanted level appear a blip in he and appear in chatbox to all the manhunt and the player to kill and the money, and if he again kill to RandomPlayer he when stop the manhunt give more money, if a RandomPlayer kill to theKiller giveMoney 10000

xD

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