tim260 Posted October 30, 2011 Posted October 30, 2011 can somebody say whats wrong with this ? local militaryMarker = createMarker(1552.33, -1605.37, 12.5, 'cylinder', 2.0, 0, 0, 255, 150 ) local account = getAccountName(getPlayerAccount(player)) function militaryMarkerHit ( hitElement, matchingDimension ) if isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then setElementModel(player, 286) giveWeapon ( player, 31, 80000 ) outputChatBox("You are now working as military", player, 0, 255, 0, false) else outputChatBox("You must be in the military group to use this command!", player, 255, 0, 0, false) end end addEventHandler( "onMarkerHit", militaryMarker , militaryMarkerHit ) Ps: i get an error when walking in to the marker
TAPL Posted October 30, 2011 Posted October 30, 2011 local militaryMarker = createMarker(1552.33, -1605.37, 12.5, 'cylinder', 2.0, 0, 0, 255, 150 ) function militaryMarkerHit ( player, matchingDimension ) if ( getElementType(player) == "player") then local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then setElementModel(player, 286) giveWeapon ( player, 31, 80000 ) outputChatBox("You are now working as military", player, 0, 255, 0, false) else outputChatBox("You must be in the military group to use this command!", player, 255, 0, 0, false) end end end addEventHandler( "onMarkerHit", militaryMarker , militaryMarkerHit )
tim260 Posted October 30, 2011 Author Posted October 30, 2011 (edited) local militaryMarker = createMarker(1552.33, -1605.37, 12.5, 'cylinder', 2.0, 0, 0, 255, 150 ) function militaryMarkerHit ( player, matchingDimension ) if ( getElementType(player) == "player") then local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then setElementModel(player, 286) giveWeapon ( player, 31, 80000 ) outputChatBox("You are now working as military", player, 0, 255, 0, false) else outputChatBox("You must be in the military group to use this command!", player, 255, 0, 0, false) end end end addEventHandler( "onMarkerHit", militaryMarker , militaryMarkerHit ) 2 errors @ getplayeraccount and @ getaccountname EDIT : thats only when i start it, when i walk in the marker i get : attempt to concatenate upvalue "account" < a boolean valeu> Edited October 30, 2011 by Guest
Aibo Posted October 30, 2011 Posted October 30, 2011 1. you must get account inside the militaryMarkerHit function 2. "hitElement" is the element that hit the marker. "player" is probably nil. 3. you should check if element is a player and he has an account local militaryMarker = createMarker(1552.33, -1605.37, 12.5, 'cylinder', 2.0, 0, 0, 255, 150 ) function militaryMarkerHit(hitElement, matchingDimension) if getElementType(hitElement) == "player" then local account = getAccountName(getPlayerAccount(hitElement)) if account and isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then setElementModel(hitElement, 286) giveWeapon(hitElement, 31, 80000) outputChatBox("You are now working as military", hitElement, 0, 255, 0, false) else outputChatBox("You must be in the military group to use this command!", hitElement, 255, 0, 0, false) end end end addEventHandler("onMarkerHit", militaryMarker, militaryMarkerHit)
tim260 Posted October 30, 2011 Author Posted October 30, 2011 1. you must get account inside the militaryMarkerHit function2. "hitElement" is the element that hit the marker. "player" is probably nil. 3. you should check if element is a player and he has an account local militaryMarker = createMarker(1552.33, -1605.37, 12.5, 'cylinder', 2.0, 0, 0, 255, 150 ) function militaryMarkerHit(hitElement, matchingDimension) if getElementType(hitElement) == "player" then local account = getAccountName(getPlayerAccount(hitElement)) if account and isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then setElementModel(hitElement, 286) giveWeapon(hitElement, 31, 80000) outputChatBox("You are now working as military", hitElement, 0, 255, 0, false) else outputChatBox("You must be in the military group to use this command!", hitElement, 255, 0, 0, false) end end end addEventHandler("onMarkerHit", militaryMarker, militaryMarkerHit) Thanks mate it works !
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now