Jump to content

getElementType !


roy_ppp

Recommended Posts

Hi all

i'm want ask all

function Sk ( source ) 
  
             local Drive = getElementType ( source ) 
        if  Drive  == "vehicle" then 
        outputChatBox(Drive) 
        triggerClientEvent( "onGreeting", source) 
        else 
        outputChatBox("Your not drive car !", source, 255,0,0) 
        outputChatBox(Drive) 
        end 
  
end 
addEventHandler("onMarkerHit", mydrop, Sk) 

:arrowup: Drive == Vehicle

but next code

function Sk ( source ) 
f ( getElementType ( source )) == "vehicle" then 
         local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) then 
         local jobanow  = getAccountData ( playeraccount, "job.Human") 
  
         if jobanow == "Dropcar" then 
                 outputChatBox(jobanow) 
             local Drive = getElementType ( source ) 
         if  Drive  == "vehicle" then 
             outputChatBox(Drive) 
             triggerClientEvent( "onGreeting", source) 
             else 
             outputChatBox("Your not drive car !", source, 255,0,0) 
             outputChatBox(Drive) 
         end 
         else  
         outputChatBox("Your not dropcar man", source) 
         end 
        end 
end 
addEventHandler("onMarkerHit", mydrop, Sk) 

:arrowup: Drive is not "vehicle" but it "player"

Why :?::?::?:

(i'm drive car and hit marker)

Link to comment

local Drive = getElementType ( source )

in both function, ur getting element type of marker ( source ) [addEventHandler ( "onMarkerHit".. ) make's marker as source )

use ( hitElement ) or so, and in function add too hitElement, not source

  
function Sk ( hitElement) 
if ( getElementType ( hitElement)) == "vehicle" then 
         local playeraccount = getPlayerAccount ( hitElement) 
        if ( playeraccount ) then 
         local jobanow  = getAccountData ( playeraccount, "job.Human") 
  
         if jobanow == "Dropcar" then 
                 outputChatBox(jobanow) 
             local Drive = getElementType ( hitElement) 
        if  Drive  == "vehicle" then 
             outputChatBox(Drive) 
             triggerClientEvent( "onGreeting", hitElement) 
             else 
             outputChatBox("Your not drive car !", hitElement, 255,0,0) 
             outputChatBox(Drive) 
         end 
         else  
         outputChatBox("Your not dropcar man", hitElement) 
         end 
        end 
end 
addEventHandler("onMarkerHit", mydrop, Sk) 
  

Link to comment

this is pure randomness:

if getElementType ( hitElement) == "vehicle" then 
local playeraccount = getPlayerAccount ( hitElement) 

vehicle account? :В

and you lost "end" that closes first "if".

Edited by Guest
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...