gghvcffcv Posted April 5, 2014 Share Posted April 5, 2014 Hey guys, How could i do that For get Money in Markers The player must be in a Truck with a trailer and if he isn't in the truck he cannot win money -- server createTeam ( "Civilians", 237, 255, 41 ) createTeam ( "Without Job", 255, 255, 255) function botonAA() local theTeam = getTeamFromName ( "Civilians" ) if ( theTeam ) then setPlayerTeam ( source, theTeam ) setPlayerNametagColor ( source, 237, 255, 41 ) setElementModel ( source, 202 ) Trailer1 = createVehicle ( 435, 1768.87231, -2049.18359, 13.56285, 0, 0, 270) end end addEvent( "botonAA", true ) addEventHandler( "botonAA", root, botonAA ) function botonBB() local theTeam = getTeamFromName ( "Civilians" ) if ( theTeam ) then setPlayerTeam ( source, theTeam ) setPlayerNametagColor ( source, 237, 255, 41 ) setElementModel ( source, 202 ) Trailer2 = createVehicle ( 435, 1768.87231, -2049.18359, 13.56285, 0, 0, 270) end end addEvent( "botonBB", true ) addEventHandler( "botonBB", root, botonBB ) function botonCC() local theTeam = getTeamFromName ( "Civilians" ) if ( theTeam ) then setPlayerTeam ( source, theTeam ) setPlayerNametagColor ( source, 237, 255, 41 ) setElementModel ( source, 202 ) Trailer3 = createVehicle ( 435, 1768.87231, -2049.18359, 13.56285, 0, 0, 270) end end addEvent( "botonCC", true ) addEventHandler( "botonCC", root, botonCC ) function botonDD() local theTeam = getTeamFromName ( "Civilians" ) if ( theTeam ) then setPlayerTeam ( source, theTeam ) setPlayerNametagColor ( source, 237, 255, 41 ) setElementModel ( source, 202 ) Trailer4 = createVehicle ( 435, 1768.87231, -2049.18359, 13.56285, 0, 0, 270) end end addEvent( "botonDD", true ) addEventHandler( "botonDD", root, botonDD ) function MarkerA() local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney (source, 10000) end end addEvent( "MarkerA", true ) addEventHandler( "MarkerA", root, MarkerA ) function MarkerB() local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney (source, 25000) end end addEvent( "MarkerB", true ) addEventHandler( "MarkerB", root, MarkerB ) function MarkerC() local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney (source, 35000) end end addEvent( "MarkerC", true ) addEventHandler( "MarkerC", root, MarkerC ) function MarkerD() local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney (source, 35000) end end addEvent( "MarkerD", true ) addEventHandler( "MarkerD", root, MarkerD ) Link to comment
Castillo Posted April 5, 2014 Share Posted April 5, 2014 getPedOccupiedVehicle getVehicleTowingVehicle Link to comment
gghvcffcv Posted April 5, 2014 Author Share Posted April 5, 2014 getPedOccupiedVehicle getVehicleTowingVehicle function MarkerC() if getPedOccupiedVehicle ( source ) and getVehicleTowingVehicle ( 435 ) then local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney (source, 35000) end end end addEvent( "MarkerC", true ) addEventHandler( "MarkerC", root, MarkerC ) Likt that? Link to comment
Castillo Posted April 5, 2014 Share Posted April 5, 2014 function MarkerC ( ) local veh = getPedOccupiedVehicle ( source ) -- Get the player vehicle. if ( veh ) then -- If he is in a vehicle... local trailer = getVehicleTowingVehicle ( veh ) -- Get the trailer of the vehicle. if ( trailer and getElementModel ( trailer ) == 435 ) then -- If it has a trailer and the trailer model is 435.. local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney ( source, 35000 ) end end end end addEvent ( "MarkerC", true ) addEventHandler ( "MarkerC", root, MarkerC ) Link to comment
gghvcffcv Posted April 5, 2014 Author Share Posted April 5, 2014 function MarkerC ( ) local veh = getPedOccupiedVehicle ( source ) -- Get the player vehicle. if ( veh ) then -- If he is in a vehicle... local trailer = getVehicleTowingVehicle ( veh ) -- Get the trailer of the vehicle. if ( trailer and getElementModel ( trailer ) == 435 ) then -- If it has a trailer and the trailer model is 435.. local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney ( source, 35000 ) end end end end addEvent ( "MarkerC", true ) addEventHandler ( "MarkerC", root, MarkerC ) Doesn't gives me the money Link to comment
gghvcffcv Posted April 5, 2014 Author Share Posted April 5, 2014 Any error in debugscript? Negative! Link to comment
gghvcffcv Posted April 6, 2014 Author Share Posted April 6, 2014 it doesn't gives none error in console But neither gives money. Link to comment
Castillo Posted April 6, 2014 Share Posted April 6, 2014 function MarkerC ( ) local veh = getPedOccupiedVehicle ( source ) -- Get the player vehicle. if ( veh ) then -- If he is in a vehicle... local trailer = getVehicleTowingVehicle ( veh ) -- Get the trailer of the vehicle. if ( trailer and getElementModel ( trailer ) == 435 ) then -- If it has a trailer and the trailer model is 435.. local theTeamX = getTeamFromName ( "Without Job" ) if ( theTeamX ) then setPlayerTeam ( source, theTeamX ) setPlayerNametagColor ( source, 255, 255, 255 ) givePlayerMoney ( source, 35000 ) else outputChatBox ( "The team doesn't exist" ) end else outputChatBox ( "Not a trailer or the trailer model is not 435" ) end else outputChatBox ( "Not in a vehicle" ) end end addEvent ( "MarkerC", true ) addEventHandler ( "MarkerC", root, MarkerC ) Link to comment
Moderators Citizen Posted April 6, 2014 Moderators Share Posted April 6, 2014 it doesn't gives none error in console But neither gives money. 5 possible reasons: 1 - the script file isn't loaded (check the meta) 2 - the MarkerC event is never triggered (I guess from the client side) 3 - you aren't in a vehicle 4 - you didn't tow a trailer or the trailer isn't the 435 one 5 - the team "Without Job" doesn't exist. Tips: - Use outputchabox everywhere in this function you can to see what's going on. (EDIT: exactly like Soldsnake just did) - It's recomended to use client istead of source because source can be faked by a hacker. 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