Jump to content

csiguusz

Members
  • Posts

    500
  • Joined

  • Last visited

Everything posted by csiguusz

  1. You can use setTimer to delay things, but you may need something else for this, especially for the login thing: To show something after the succesful login just run a function that opens the team panel. -- your script... if login == "succesful" then openTeams() end function openTeams() -- your team chooser end
  2. Using a local variable instead of a global one can be a bit faster ( http://lua-users.org/wiki/OptimisingUsingLocalVariables ) But i know, it is not necessary and doesn't counts much in this case.
  3. What doeas "Not Working" mean? still wrong pos? or any error messages?
  4. I think novo meant something like this: local x1,y1,z1 = getElementPosition ( marker ) local x2,y2,z2 = getElementPosition ( marker1 ) local x3,y3,z3 = getElementPosition ( marker2 ) local screenWidth, screenHeight = guiGetScreenSize ( ) local x1_, y1_, dis = getScreenFromWorldPosition( x1, y1, z1 ) local x2_, y2_, dis = getScreenFromWorldPosition( x2, y2, z2 ) local x3_, y3_, dis = getScreenFromWorldPosition( x3, y3, z3 ) dxDrawText("police job", x1_ + 2, y1_ + 2,screenWidth,screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown" ) dxDrawText("police job", x2_ + 2, y2_ + 2,screenWidth,screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown" ) dxDrawText("police job", x3_ + 2, y3_ + 2,screenWidth,screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown" )
  5. Drift = createTeam( "Players Drift",255,255,0) addEvent("Drift",true) addEventHandler("Drift",root, function ( ) spawnPlayer ( source, -1819.62439, -3737.35132, -3003.31567,32.63086, 46, 0, 0, getTeamFromName ( "Players Drift" ) ) setPlayerTeam ( source, Drift ) setElementData(source,"x",-1819.62439) setElementData(source,"y",-3737.35132) setElementData(source,"z",-3003.31567) setElementData ( source, "team", getTeamName ( Drift ) ) end ) function spawn(player) local x = getElementData(player,"x") local y = getElementData(player,"y") local z = getElementData(player,"z") local team = getTeamFromName(getElementData(player,"team")) local skin = getElementData(player,"skin") spawnPlayer(player,x,y,z,0,skin,0,0,team) r, g, b = getTeamColor ( getPlayerTeam ( player ) ) setPlayerNametagColor ( player, r, g, b ) giveWeapon ( player , 16, 1 ) giveWeapon ( player , 31, 100 ) giveWeapon ( player , 24, 100 ) fadeCamera(player,true) setCameraTarget(player,player) end addEvent("spawnPlayer",true) addEventHandler("spawnPlayer",root, function () spawn(source) end ) addEventHandler("onPlayerWasted",root, function () setTimer(spawn,3000,1,source) end ) addEventHandler("onPlayerWasted",root, function (_,killer) if ( killer and killer ~= source ) then givePlayerMoney(killer,math.random(5000)) end end ) addEvent ( "takeWeapons", true ) addEventHandler( "takeWeapons", root, function ( ) takeAllWeapons ( source ) setPlayerTeam ( source, nil ) end ) local g_szTeam = "Players Drift"; local g_pPosition = { -3737.35132, -3003.31567,32.63086 }; addEventHandler( "onPlayerWasted", root, function( ) local pTeam = getPlayerTeam( source ); if ( pTeam and getTeamName( pTeam ) == g_szTeam ) then spawnPlayer( source, unpack( g_pPosition ) ); takeAllWeapons ( source ) setPedSkin ( source, 46 ) takeAllWeapons ( source ) end end )
  6. But you can define it for better performance
  7. dxDrawText just read the wiki about it. You can't use the same coordinates for this, what you used to create a marker.
  8. Or just do showChat(false)
  9. ourGroup is not a string, it's an ACL group, so can't concatenate it. -- use this warnText( "Group created:"..groupName , thePlayer ) -- or this: warnText( "Group created:"..aclGroupGetName(ourGroup) , thePlayer )
  10. client: function firing( _, _, _, _, _, _, hitElement) if hitElement and getElementType( hitElement ) == "vehicle" and getElementHealth(hitElement) <= 300 and not getElementData(hitElement,"lastDamageFrom") then setElementData(hitElement,"lastDamageFrom",getLocalPlayer()) end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), firing ) server: function add() local player = getElementData(source,"lastDamageFrom") if player then if (getVehicleType ( source ) == "Automobile")then iii(player) elseif (getVehicleType ( source ) == "Helicopter")then ooo(player) elseif (getVehicleType ( source ) == "Boat")then lll(player) end end end addEventHandler("onVehicleExplode", getRootElement(), add ) This is maybe not the most efficient solution, but should work.
  11. Start thinking I'm doing it too.
  12. So, in this case I dont have any idea... it would be hard to find out who actually destroyed a vehicle.
  13. Oh, you are right, with those events you can't check who destroyed a vehicle...
  14. This is because it gives you points every time you shoot the specified vehicle, not only when it's destroyed. Use an another event instead of onClientPlayerWeaponFire, like onClientVehicleExplode (client-side) or onVehicleExplode (server-side).
  15. Hm? Could you please explain this, because i don't understand.
  16. client: function firing( _, _, _, _, _, _, hitElement) if hitElement and getElementType( hitElement ) == "vehicle" then triggerServerEvent("onFire", getLocalPlayer(), hitElement) end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), firing ) server: function add( veh ) if (getVehicleType ( veh) == "Automobile")then iii(source) elseif (getVehicleType ( veh ) == "Helicopter")then ooo(source) elseif (getVehicleType ( veh ) == "Boat")then lll(source) end end addEvent("onFire",true) addEventHandler("onFire", getRootElement(), add )
  17. Isn't it possible to do this with the lua string library?
  18. And what is you problem? function add() if (getVehicleType ( source ) == "Automobile")then addEventHandler("onVehicleExplode", getRootElement, iii) else if (getVehicleType ( source ) == "Helicopter")then addEventHandler("onVehicleExplode", getRootElement, ooo) else if (getVehicleType ( source ) == "Boat")then addEventHandler("onVehicleExplode", getRootElement, lll) end end end end Adding an event handler on each shot is not a good idea... function firing( _, _, _, _, _, _, hitElement) if hitElement and getElementType( hitElement ) == "Vehicle" then triggerServerEvent("onFire", getRootElement()) end end Use hitElement instead of getRootElement() as the source of the event if you want to get the type of the vehicle on server side. And the element type can't be "Vehicle", but "vehicle".
  19. True, but isn't it easier to use this db for the first time? Btw with this function the datas are stored in the registry.db in the deathmatch folder.
  20. **facepalm** Sorry! So will i need the modules for this to work? No. dbConnect is a built-in mta function.
  21. Ah, so this is your problem, that wasted players are set to another team automatically and you dont want that... Or you want to set the player's team to police when they die? Sorry, maybe because its late today, but i did understand whats your problem exactly.
  22. You dont have to "connect your server to mysql". Just the scripts can connect to a database or éven use a database file to store there information. For example check the dbConnect function.
  23. I did not check your whole script, but setPlayerTeam(source, pTeam) on line 11 won't set the player's team to an another, because it is the player's current team.
  24. i cant see a "script scr" in your meta.xml just a map
×
×
  • Create New...