-misterX- Posted January 20, 2013 Posted January 20, 2013 why it says bad argument line 25 and 26? markerp = createMarker( 1556.9852294922, -1608.1356201172, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker2p = createMarker( 1570.1909179688, -1610.1462402344, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker3p = createMarker( 1584.61328125, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker4p = createMarker( 1595.1407470703, -1607.5220947266, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) local vehicles = {} function spawnVehP(id) local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 1, y, z) warpPedIntoVehicle(source, vehicles[source]) end addEvent("CreVehiceP",true) addEventHandler("CreVehiceP", root, spawnVehP) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) local playerTeam = getPlayerTeam( source ) local teamName = getTeamName( playerTeam ) function showGUIp(hitPlayer) if teamName == "police" then triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) else warnText("You nedd to be police to get a vehicle",source) end end addEventHandler("onMarkerHit",markerp,showGUIp) function showGUIp(hitPlayer) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker2p,showGUIp) function showGUIp(hitPlayer) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker3p,showGUIp) function showGUIp(hitPlayer) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker4p,showGUIp)
iPrestege Posted January 20, 2013 Posted January 20, 2013 source is not defined so he is have to change it to : local playerTeam = getPlayerTeam( player ) and fined the player in the function
-misterX- Posted January 20, 2013 Author Posted January 20, 2013 what now? function showGUIp(hitPlayer) local playerTeam = getPlayerTeam( hitPlayer ) local teamName = getTeamName( playerTeam ) if teamName == "police" then triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) else warnText("vehicles for police only!",hitPlayer) end end addEventHandler("onMarkerHit",markerp,showGUIp) addEventHandler("onMarkerHit",marker2p,showGUIp) addEventHandler("onMarkerHit",marker3p,showGUIp) addEventHandler("onMarkerHit",marker4p,showGUIp)
3NAD Posted January 20, 2013 Posted January 20, 2013 Tell me the Results : function showGUIp ( hitPlayer ) if source == ( markerp or marker2p or marker3p or marker4p ) then local policeTeam = getTeamFromName ( "police" ) if policeTeam then if getPlayerTeam ( hitPlayer ) == policeTeam then triggerClientEvent ( hitPlayer, "showGUI2p", hitPlayer, hitPlayer ) else warnText ( "vehicles for police only!", hitPlayer ) end end end end addEventHandler ( "onMarkerHit", root, showGUIp )
MR.S3D Posted January 20, 2013 Posted January 20, 2013 (edited) function showGUIp(hitPlayer) if hitPlayer and getElementType(hitPlayer) == "player" then if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "police" ) ) then triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) else warnText("vehicles for police only!",hitPlayer) end end end addEventHandler("onMarkerHit",markerp,showGUIp) addEventHandler("onMarkerHit",marker2p,showGUIp) addEventHandler("onMarkerHit",marker3p,showGUIp) addEventHandler("onMarkerHit",marker4p,showGUIp) Edited January 20, 2013 by Guest
-misterX- Posted January 20, 2013 Author Posted January 20, 2013 fixed by myself, thanks for the help
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