Jump to content

Imposter

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by Imposter

  1. Hi, i want to know if there is any possible way to get the scoreboard/and other resources to parse colour codes that people put in their names??
  2. Thank you blazy, that worked, but i need this last bit of info, i get a warning saying that getPedOccupidVehicle on line 2 is not a valid arg, why?? here is the code\ addEvent ( "onMapStarting" ) theVehicle = getPedOccupiedVehicle ( source ) function setLightColours ( source, commandName, r, g, b ) local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then setAccountData ( playerAccount, "idd.cchcr", r) setAccountData ( playerAccount, "idd.cchcg", g) setAccountData ( playerAccount, "idd.cchcb", b) setVehicleHeadLightColor ( theVehicle, r,g,b) setVehicleOverrideLights ( theVehicle, 2 ) outputChatBox ( "Your Chosen Light Colours have Been Saved!", source) end end addCommandHandler("setLightColours", setLightColours) function setCarColours () local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then local color1, color2, color3, color4 = getVehicleColor ( theVehicle ) setAccountData ( playerAccount, "idd.ccolor1", colour1 ) setAccountData ( playerAccount, "idd.ccolor2", colour2 ) setAccountData ( playerAccount, "idd.ccolor3", colour3 ) setAccountData ( playerAccount, "idd.ccolor4", colour4 ) local crdone = outputChatBox ( "Your Current Car Colours have Been Saved!", source) end end addCommandHandler("setCarColours", setCarColours) function setAllColours(_, playerAccount) outputChatBox ("Broken!",source) local color1 = getAccountData ( playerAccount, "idd.ccolor1") local color2 = getAccountData ( playerAccount, "idd.ccolor2") local color3 = getAccountData ( playerAccount, "idd.ccolor3") local color4 = getAccountData ( playerAccount, "idd.ccolor4") local r = getAccountData ( playerAccount, "idd.cchcr" ) local g = getAccountData ( playerAccount, "idd.cchcg" ) local b = getAccountData ( playerAccount, "idd.cchcb" ) local cr = tonumber ( r ) local cg = tonumber ( g ) local cb = tonumber ( b ) setVehicleColor ( theVehicle, color1, color2, color3, color4 ) setVehicleHeadLightColor ( theVehicle, cr,cg,cb) end addCommandHandler ( "restoreColours", setAllColours) addEventHandler ( "onMapStarting", getRootElement(),setAllColours )
  3. If i understand you correctly, this is what i am suppoesed to do right? but i get this message in the console: "WARNING: [gamemodes]\[race]\[addons]\gr_stats\server.lua:32: Bad arguement @ 'addEventHandler' [Expected at argument 2, got function]" Here is my meta... <meta> <info name="IDD Stats" addon="race" /> <script src="server.lua" type="server" /> </meta> Here is my code... addEvent ( "onMapStarting" ) function saveColours ( playerSource ) local playerAccount = getPlayerAccount ( playerSource ) local playerVehicle = getPlayerOccupiedVehicle ( playerSource ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then local color1, color2, color3, color4 = getVehicleColor ( playerVehicle ) local r, g, b = getVehicleHeadLightColor ( playerVehicle ) setAccountData ( playerAccount, "idd.ccolor1", colour1 ) setAccountData ( playerAccount, "idd.ccolor2", colour2 ) setAccountData ( playerAccount, "idd.ccolor3", colour3 ) setAccountData ( playerAccount, "idd.ccolor4", colour4 ) setAccountData ( playerAccount, "idd.cchcr", r) setAccountData ( playerAccount, "idd.cchcg", g) setAccountData ( playerAccount, "idd.cchcb", b) outputChatBox ( "Your Chosen Colours have Been Saved!", source) end end addCommandHandler("saveColours", saveColours) function setCarColours(_, playerAccount) local playerVehicle = getPlayerOccupiedVehicle ( source ) local color1 = getAccountData ( playerAccount, "idd.ccolor1") local color2 = getAccountData ( playerAccount, "idd.ccolor2") local color3 = getAccountData ( playerAccount, "idd.ccolor3") local color4 = getAccountData ( playerAccount, "idd.ccolor4") local r = getAccountData ( playerAccount, "idd.cchcr" ) local g = getAccountData ( playerAccount, "idd.cchcg" ) local b = getAccountData ( playerAccount, "idd.cchcb" ) setVehicleColor ( playerVehicle, color1, color2, color3, color4 ) getVehicleHeadLightColor ( playerVehicle, r,g,b) end addEventHandler ( "onMapStarting" ,setCarColours )
  4. oh sorry, i get it. in my meta i need to pu addon="race" and in my script i need to do addEvent("onMapStarting") and in the event handler i put onMapStarting,right?
  5. how would i do it, do i have to add, addEvent somewhere? or do i have to change my meta to load the dependancy?
  6. playerAccount = getPlayerAccount ( source ) playerVehicle = getPlayerOccupiedVehicle ( playerSource ) function saveColours () if ( playerAccount ) and not isGuestAccount ( playerAccount ) then local color1, color2, color3, color4 = getVehicleColor ( playerVehicle ) local r, g, b = getVehicleHeadLightColor ( playerVehicle ) setAccountData ( playerAccount, "idd.ccolor1", colour1 ) setAccountData ( playerAccount, "idd.ccolor2", colour2 ) setAccountData ( playerAccount, "idd.ccolor3", colour3 ) setAccountData ( playerAccount, "idd.ccolor4", colour4 ) setAccountData ( playerAccount, "idd.cchcr", r) setAccountData ( playerAccount, "idd.cchcg", g) setAccountData ( playerAccount, "idd.cchcb", b) end end addCommandHandler("saveColours", getRootElement(), setColours) function setCarColours() local color1 = getAccountData ( playerAccount, "idd.ccolor1") local color2 = getAccountData ( playerAccount, "idd.ccolor2") local color3 = getAccountData ( playerAccount, "idd.ccolor3") local color4 = getAccountData ( playerAccount, "idd.ccolor4") local r = getAccountData ( playerAccount, "idd.cchcr" ) local g = getAccountData ( playerAccount, "idd.cchcg" ) local b = getAccountData ( playerAccount, "idd.cchcb" ) setVehicleColor ( playerVehicle, color1, color2, color3, color4 ) getVehicleHeadLightColor ( playerVehicle, r,g,b) end addEventHandler("",getRootElement(),setCarColours) This should work right? but what handler do i use for the colours, when a car is spawned, i am using the resource race.
  7. Just one more thing, how do i get the cars headlight color?
  8. YOU can do that?? Thanks!!
  9. Hi guys, im making a derby server, I need help with storing info to the user's account, some of the information i need to store is, the player's rank from all the players in the server based on points(which also needs to be stored) and the players chosen skin, and car colour/headlight color. Help Please and thank you
  10. oh, ive never done this before, so i was just giving a hint on how to do it, using some knowledge on texturing. but glad i helped.
  11. that is quite easy, this is done using textures, so first, get txd workshop, extract infernouses texture, open it in photoshop, change the lights, and go here EngineImportTXD outputChatBox ( "Replaced 411 infernous texture" ) txd = engineLoadTXD ( "data/your texture here.txd" ) engineImportTXD ( txd, 411) Hope it helps!
  12. Hello, i need some help with some code, i want to make a script so when a player steps on the collision, some random objects(from an array) are spawned, and the player is able to pick them up and put them in their car, much like a robbing script and once a place has been robbed, the collision and blip will respawn after 5-8 mins. but how do i do that? this is all i have. local collisions= { { 1,1,1 }; { 2,3,4 }; { 2,2,2 }; { 4,3,2 }; } function createColshapesOnStart () --need to create mapblips and collsions --I dont know how to do this. end addEventHandler ("onResourceStart", resourceroot(), createColShapesOnStart) function playerStepOnCollision() --i want it to put 1-5 items from an array randomly near the collision, and the player must be able to pick them up and store them in a car(and the car can only store a number of items, depending on if its a van or car or truck) end
  13. Are you getting the same crash error? when does your crash happen?on server start?or client start?
  14. i suck at this, cant get anything right would you mind helping me out with the previous code you gave me? --if you still remember, it tells the zoneowner if there is a player in it, now i want to change it so it only tells a person in the team "Street Racers" that there is a player in the "Police Officers" Team nearby when a player from the "Police Officers" team steps in the collision. local playerZones = { } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do playerZones [ player ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ player ], player, 0, 0, 0 ) setElementData ( playerZones [ player ], "zoneOwner", player ) addEventHandler ( "onColShapeHit", playerZones [ player ], zoneEnter ) end end ) function createZone ( ) playerZones [ source ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ source ], source, 0, 0, 0 ) setElementData ( playerZones [ source ], "zoneOwner", source ) addEventHandler ( "onColShapeHit", playerZones [ source ], zoneEnter ) playerTeam = getTeamName ( getPlayerTeam ( source ) ) outputChatBox ( playerTeam, source ) end addEventHandler ( "onPlayerJoin", root, createZone ) addEventHandler ( "onPlayerSpawn", root, createZone ) function destroyZone ( ) if ( isElement ( playerZones [ source ] ) ) then destroyElement ( playerZones [ source ] ) end end addEventHandler ( "onPlayerQuit", root, destroyZone ) function zoneEnter ( ) if ( zoneOwner ) == false then outputChatBox ("There is a player in your zone!",zoneOwner) end end function giveMoney ( ) for index, player in ipairs ( getElementsWithinColShape ( playerZone, "player" ) ) do givePlayerMoney ( player, 5000 ) outputChatBox ("Congratulations, you have been rewarded $5000 for capturing " .. root ,player) destroyZone() end end addEventHandler ( "onPlayerWasted", root, giveMoney )
  15. how can i change it so if my car is damaged and my team is "Police Officers" it says you are a cop?
  16. can you please explain why this doesnt work? function damage() playerTeam = getTeamName ( getPlayerTeam ( source ) ) if playerTeam == ("Police Officers") then outputChatBox ("COP",source) else outputChatBox ("Not A COP",source) end if end addEventHandler( "onVehicleDamage", root, damage)
  17. function playerTeamC () local playerTeam = getPlayerTeam ( source ) outputChatBox ( playerTeam, source ) end addEventHandler ( "onPlayerSpawn", source, playerTeamC) This should work shouldn't it? I get this message in the console "WARNING: [GRNFS]\gr_cteam\server.lua:2: Bad 'player' pointer @ 'getPlayerTeam'(1)
  18. My bad, i didnt realize that you posted a code, sorry stupid me. OMG THANK YOU, IT WORKED you are truely amazing!!
  19. what do you mean>? it is there c_root = getRootElement() function createZone () playerZone = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZone, c_root, 0, 0, 0 ) outputChatBox ( "created", source ) end addEventHandler ( "onPlayerJoin", c_root, createZone ) addEventHandler ( "onResourceStart", c_root, createZone ) function zoneEnter () outputChatBox("A Player is in Your Zone!", c_root) end addEventHandler ( "onColShapeHit", playerZone, zoneEnter ) --Here is the event handler function giveMoney() for index, player in ipairs ( getElementsWithinColShape ( playerZone, "player" ) ) do givePlayerMoney( player, 5000 ) end end addEventHandler ("onPlayerWasted", c_root, giveMoney ) and i Cant really test it out unless i have two mta copies running, which is not possible without a vm. Im trying to make a simple cop script so all cops in that area get paid.
  20. here is a screen shot of the console...http://delta.gamerush.si6.us/mtasa/Untitled.png
  21. Ok, the givemoney function is there to give money to the players who are in the collision when the source player dies. also, when i start it in the server, it says, server.lua :13 @bad argument addEventHandler, expected element at argument 2
×
×
  • Create New...