CigareTTe~ Posted August 3, 2013 Share Posted August 3, 2013 Hello friends: The player would start to spawn when the theft. But the resource is not working. Codes: local robberHouses = { { 801.40002441406, -1600.4000244141, 12.300000190735 }; { 2102.6999511719, -1806.5999755859, 12.199999809265 }; { 1194.5, -922.29998779297, 41.700000762939 }; } function unpackRobberHouses () return unpack ( robberHouses [ math.random ( #robberHouses ) ] ) end function robson( player ) destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) end addEventHandler ( "onPlayerWasted", getRootElement(), robson ) addEventHandler ( "onPlayerSpawn", root, function ( player ) team = getPlayerTeam(player) if (getTeamName(team) == "Criminals") then triggerEvent ( "createHouseEvent", player ) end end) addEvent ( "createHouseEvent", true ) function createHouses () x, y, z = unpackRobberHouses () robhouseMarker = createMarker ( x, y, z, "cylinder", 10, 255, 51, 102, 85, localPlayer ) robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) end addEventHandler ( "createHouseEvent", root, createHouses ) addEventHandler ( "onClientMarkerHit", root, function ( hitElement ) if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then triggerServerEvent ( "givePlayerPay", localPlayer ) destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) triggerEvent ( "createHouseEvent", localPlayer ) playSound ( "files/cash.mp3", false ) end end ) Link to comment
xXMADEXx Posted August 4, 2013 Share Posted August 4, 2013 What does debugscript say? Link to comment
csiguusz Posted August 4, 2013 Share Posted August 4, 2013 You might have some other problems too, but your onPlayerSpawn event isn't good. The first argument is the X coordinate not the player, use source instead. addEventHandler ( "onPlayerSpawn", root, function ( ) team = getPlayerTeam( source ) if (getTeamName(team) == "Criminals") then triggerEvent ( "createHouseEvent", source ) end end) Or you don't even have to get the team if you do it so: addEventHandler ( "onPlayerSpawn", root, function ( _, _, _, _, team ) if team and (getTeamName(team) == "Criminals") then triggerEvent ( "createHouseEvent", source ) end end) Link to comment
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