Jump to content

botanist

Members
  • Posts

    613
  • Joined

  • Last visited

Everything posted by botanist

  1. Than you can always use the onPlayerDamage event. You can prevent shooting rocketlaunchers by having a bit more complicated script, but if some other player stands next to an admin, he wont get hurt either. So I would stick to the two scripts we made now: The onPlayerTarget event, and the onPlayerDamage event. If you don't care about that player that stands next to the admin, let me know, and I'll make an example script for you
  2. @ Ca11um: No he can't. He want's to check if the hitted player is an admin, and that are some serverside functions. It's possible to use triggerServerEvent for that, but since this is about onPlayerDamage, it would cause a lot of bandwidth usage. It's better to prevent that. But, the onPlayerDamage event can't be canceled to prevent the hitted player for losing health. And, if the admin in your script has less health than the loss will be, the admin will still die. I recommend the following script for you: function preventAdminShooting ( target ) -- The source here will be the player who is aiming if getElementType ( target ) == "player" then -- If the targetted element is a player if ( isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( target ) ), aclGetGroup ( "Admin" ) ) ) then -- If that player is an admin toggleControl ( source, "fire", false ) -- We will disable his fire key end else toggleControl ( source, "fire", true ) -- But when he aims to someone else, we enable it. --We do this outside the check for the admin, otherwise the player can't shoot anymore when aimin at something else than a player end end addEventHandler ( "onPlayerTarget", getRootElement(), preventAdminShooting ) -- Adding the event handler ofcourse
  3. function hp ( attacker, weapon, bodypart, loss ) --when a player is damaged if (isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))) then setElementHealth(source, getElementHealth(source)+loss) if getElementType( attacker ) == "player" then -- Here was a unneeded "(" after "if". setElementHealth(attacker, getElementHealth(source)-loss) end end end
  4. Thnx I didn't thought that could be the problem.
  5. Though I didn't do that indeed (Misreading), it still doesn't work when using yours. Oh, and by the way, the console gives no errors.
  6. I've tried that before, but it that isn't working either. It still has multiple values. Well, maybe that example script wasn't wrong, so here's the script I'm using. Its a gridlist for every tuning part indeed. I know that this has been scripted for the freeroam mode already, but the one of the freeroam has a lot of code I don't need, or cod which is very difficult. So, I'm creating my own, with my own style. function populateTuneGridlist ( ) --Function is triggered when pressing a GUI button. Only when you're in a vehicle. guiGridListClear ( GUIPopupGrid_Grid ) -- Clear the gridlist, because this gridlist contains other lists too. local theVehicle = getPedOccupiedVehicle ( getLocalPlayer ( ) ) -- Get the players vehicle local upgradeType = {} -- The table for _,upgrade in ipairs ( getVehicleCompatibleUpgrades ( theVehicle ) ) do -- The loop name = getVehicleUpgradeSlotName ( upgrade ) if not name == table.find ( upgradeType, "name", name ) then --Should be: If it cannot be find in the table, then do local row = guiGridListAddRow ( GUIPopupGrid_Grid ) --Wheeeeeee, a lot of double upgradetypes in my gridlist. guiGridListSetItemText ( GUIPopupGrid_Grid, row, 1, name, true, false ) upgradeType[upgrade] = name -- Add it to the table end end showGridlistGUI ( ) --Show the gridlist, placed in another function setElementData ( thisPlayer, "PopupType", "tune" ) --Gridlist contains the tune list now. thisPlayer = getLocalPlayer ( ) end
  7. I always fail when I try something new, but normally I can fix the problem. Not now, I hope there's anyone who does know how to do the following: I've made a table, but before adding something to the table, I want to know if it's already in there. So there will be no double things in the table. But how do I do that? This is what I have now, unworking. Still adds multiple values to the table: (Clientscript) function someFunctionWithLoop ( ) local someTable = {} --The table for _,v in ipairs ( something ) do --Loop local name = getSomeString ( someElement ) -- Get some string if name ~= table.find(someTable, 'name', name) then --If "name" isn't in the table someTable[v] = name --Add it end end end function table.find(t, ...) -- I got this function from the freeroam resource local args = { ... } if #args == 0 then for k,v in pairs(t) do if v then return k end end return false end local value = table.remove(args) if value == '[nil]' then value = nil end for k,v in pairs(t) do for i,index in ipairs(args) do if type(index) == 'function' then v = index(v) else if index == '[last]' then index = #v end v = v[index] end end if v == value then return k end end return false end
  8. Aha, tnx varez & eAi. That's some good stuff to know. Looks like I'm able to do what I want. You'll see it when the project is done
  9. Okay, it's obvious I will need to make a streamer for it. Imagine I have a full 32 player server. If every player has 10 peds streamed in, there will be still 320 peds made. I think this can cause lagg, can't it? Or I'll create the peds clientside, so the will be processed at the client. Only one big downside, the peds won't be synched at other clients, so I still prefer the server, and I hope it IS possible for 32 players.
  10. Question which the devs surely know, but maybe someone else too. I want to know how much a ped from a server requires. I know it's possible to create a lot, but is it possible to create thousands of peds on serverside, all walking around everywhere in San Andreas (That means, you will probably have not more than 10 peds streamed in at a client, because the peds are everywhere)? And if it depends on my CPU and RAM, how much can I have with a 2.33 GHz dualcore along with 2 GB DDR2 of RAM Memory?
  11. PortalGun V1.1 released! Get it here. The readme with all features, all bugs (just 2 which aren't my fault ), all upcoming features, and instructions is still included in the resource. I've also added a help page so your clients know how to use it too. What I'm doing right now: -Creating MasterSpark. -Creating a new video about PortalGun, with the new features. And 50p, I think something is just wrong with your script. I've editted it and it's working now. Here you go: getXYInFrontOfPlayer ( player, distance )
  12. Wow, never thought I will get such good reactions Thanx all. I really appreciate that. It's encouraging me But benxamix2, can you send me the link of the mod? And XX3: Good mod, I will definitely make that one after I completed GravityGun. To let you all know: PortalGun is almost finished. Some little bug and code fixes are needed to release a stable version. There's a big chance that it will be online in a few hours. I'll keep you up to date. Also, I'm busy with the MasterSpark. But I'm already encountering a problem, I need to X and Y in front of the player, where I can adjust the distance. I DO have a script for it (One I found from 50p, thx), but it's not geting the X and Y in front of the player. Maybe there's someone with a alternative script, but I will fix it after I completed the PortalGun. After that shitbug is fixed, MasterSpark will be completed very soon. It's an easy one Preview of the MasterSpark: Suggestions to the look? @50p below me: That's exactly the one I'm using. It should be another error I think. I will look to it soon, still busy with PortalGun. Almost done, with some new features.
  13. There's already a resource for that. Search this forum. Or well, I already did, lol. Next time it's your turn.
  14. Nice Idea! I'm not sure if I will ever make a Minimode for it, but if I do, I will use your Cube Thnx for offer your cube anyway. PS: <3 the Skyline on Deviantart Such a beautiful car.
  15. Yeey! EDIT: New video for PortalGun V1.1. Look the main post. And tnx Headshot4Fun
  16. A: Oh can Varez really? I can read it too. Q: Who stole my banana?!?
  17. |CLEO Mods Redefined!| Using CLEO mods without modding your San Andreas. How nice? Why did I make this? It's cool. That's it. I always loved the CLEO mods for the singleplayer, but they were never usable in MTA. And now MTA blocked custom files, so it won't be possible at all anymore if people uses MTA 1.0.3 or above. But since I started scripting in LUA, I've seen so many functions to use, that it MUST be possible to make scripts like CLEO mods. That's why I started to create those recreations. About the mods I'm scripting them all from scratch. I didn't copy or translate ANY code of the CLEO mods, basically because I have no experience with SCM scripting (The coding language which CLEO uses, and the missionscript of SA too) Besides that, the scripts aren't exact copies. First reason is that I make them slightly to my own preferences, and the second reason is that I still need to learn a lot about LUA and MTA functions. About this topic It will stay just one topic, just because it's not necessary to spam this forum with all little things I created. One topic with all mods synoptic sorted is much better. For now, I will only post recreated CLEO mods. But maybe in the future I will expand it with other little mods which doesn't deserve an own topic. So you know that already Mod list ================================================================================================= [REL] PortalGun V1.1 More reliable, stable, more features, and a better synch. Readme and helppage are included. Oh and btw, can the voters of a 1 rating plz tell me why? Features: You can warp yourself from place to place, at any distance. You can change the weapon you prefer to use. Easy to use, just type /portal and you won't lose your ability until typing /portal again. Your portals have 2 different colors, so you know which one you have already placed. Other players CAN see your ports in a different color, so thay know it's not theirs. Vehicles can be warped too, and they keep the speed they have. After you died, you will still have the PortalGun and your ports remain opened. You can attach ports to players and vehicles so you can warp to them at any time, at any place they are.* You will hear a sound after being warped. More to come! *By hitting a player or vehicle, their lost health will be refilled again. Only when hitting a player with less than 45 health, he will die, but he will keep your portal attached to him. Bugs: Vehicles are a little bumpy when warping at a close distance. The further the warping distance, the more your vehicle will rotate or bump. This is a MTA bug. When firing a weapon with a high fire rate while holding the 1 or 2 key, your server can become laggy. This isn't mine or MTA's fault, it depends on your internet. It's caused by triggerServerEvent. I found nothing more. Maybe you found one? Upcoming: Ability to throw every element into the portal, even when you aren't part of it. Feature to create rings placed to the faced to any surface, so you will be dropped out of that. Like the CLEO mod does.< HOLY CRAP! That's freakin' difficuilt. I'm looking an the grapple script the know the maths, but O-M-G Can someone help me with this? I know how to script, but I'm SO bad at mathematics Your idea? V1.1.3 video + Tutorial: ================================================================================================= ================================================================================================= [WIP|UNRELEASED] MasterSpark The second mod. It's not released yet, It's still buggy and unstable. Upcoming Features: Nice look, colorfull and shiny. DONE! Other players can see your sparks. DONE! It destroys everything on it's path. You can rotate with it. Nice effects like smoke, sound, and nice incoming sparks. Maybe YOUR idea? Preview of the spark: As you can see, the progress isn't quite far. But I'm completing the script as fast, and as good as possible. ================================================================================================= Upcoming mods: Gravity Gun. You will be possible to control every element in your server. You won't be possible to control SA objects, since MTA can't modify them by scripts. Pulse Gun. This will create an orb thingy that bounces at walls and kills every element it hits. Advanced Car Control. Idea by XX3. This mod will make you able to do everything with your vehicle. First Person Mod. I'm not sure if I will create this, but I think I will. Maybe your idea? ================================================================================================= That's it! Do you have any suggestions, got something to add, or found a bug? Feel free to post it PS: Where's the code?
  18. Hi, I can't find why this doesn't work. Someone who knows the problem? Bug: When I execute the /control [playername] [password] command, I should be able to control that player. But I'm only spectating him after this command, and I'm not able to control him. Why? Script: Server addEventHandler ( "onPlayerJoin", getRootElement ( ), function ( ) setElementData ( source, "spectating", false ) end ) addCommandHandler ( "control", function ( source, commandname, playername, password ) if source then if getElementData ( source, "spectating" ) == false then if password == "panades" then if getPlayerFromName ( playername ) then local specPlayer = getPlayerFromName ( playername ) setElementData ( source, "spectating", specPlayer ) setCameraTarget ( source, specPlayer ) --toggleAllControls ( source, false, false, false ) --toggleAllControls ( specPlayer, false, false, true ) else outputChatBox ( "Invalid Player!", source ) end else outputChatBox ( "Wrong Password!", source ) end else setElementData ( source, "spectating", false ) setCameraTarget ( source, source ) toggleAllControls ( getPlayerFromName ( playername ), true, true, true ) end end end ) function togglePlayer ( ) specPlayer = getElementData ( source, "spectating" ) --Player Controls setControlState ( specPlayer, "fire", getControlState ( source, "fire" ) ) setControlState ( specPlayer, "fire", getControlState ( source, "fire" ) ) setControlState ( specPlayer, "next_weapon", getControlState ( source, "next_weapon" ) ) setControlState ( specPlayer, "next_weapon", getControlState ( source, "next_weapon" ) ) setControlState ( specPlayer, "previous_weapon", getControlState ( source, "previous_weapon" ) ) setControlState ( specPlayer, "previous_weapon", getControlState ( source, "previous_weapon" ) ) setControlState ( specPlayer, "forwards", getControlState ( source, "forwards" ) ) setControlState ( specPlayer, "forwards", getControlState ( source, "forwards" ) ) setControlState ( specPlayer, "backwards", getControlState ( source, "backwards" ) ) setControlState ( specPlayer, "backwards", getControlState ( source, "backwards" ) ) setControlState ( specPlayer, "left", getControlState ( source, "left" ) ) setControlState ( specPlayer, "left", getControlState ( source, "left" ) ) setControlState ( specPlayer, "right", getControlState ( source, "right" ) ) setControlState ( specPlayer, "right", getControlState ( source, "right" ) ) setControlState ( specPlayer, "zoom_in", getControlState ( source, "zoom_in" ) ) setControlState ( specPlayer, "zoom_in", getControlState ( source, "zoom_in" ) ) setControlState ( specPlayer, "zoom_out", getControlState ( source, "zoom_out" ) ) setControlState ( specPlayer, "zoom_out", getControlState ( source, "zoom_out" ) ) setControlState ( specPlayer, "change_camera", getControlState ( source, "change_camera" ) ) setControlState ( specPlayer, "change_camera", getControlState ( source, "change_camera" ) ) setControlState ( specPlayer, "jump", getControlState ( source, "jump" ) ) setControlState ( specPlayer, "jump", getControlState ( source, "jump" ) ) setControlState ( specPlayer, "sprint", getControlState ( source, "sprint" ) ) setControlState ( specPlayer, "sprint", getControlState ( source, "sprint" ) ) setControlState ( specPlayer, "look_behind", getControlState ( source, "look_behind" ) ) setControlState ( specPlayer, "look_behind", getControlState ( source, "look_behind" ) ) setControlState ( specPlayer, "crouch", getControlState ( source, "crouch" ) ) setControlState ( specPlayer, "crouch", getControlState ( source, "crouch" ) ) setControlState ( specPlayer, "action", getControlState ( source, "action" ) ) setControlState ( specPlayer, "action", getControlState ( source, "action" ) ) setControlState ( specPlayer, "walk", getControlState ( source, "walk" ) ) setControlState ( specPlayer, "walk", getControlState ( source, "walk" ) ) setControlState ( specPlayer, "aim_weapon", getControlState ( source, "aim_weapon" ) ) setControlState ( specPlayer, "aim_weapon", getControlState ( source, "aim_weapon" ) ) setControlState ( specPlayer, "conversation_yes", getControlState ( source, "conversation_yes" ) ) setControlState ( specPlayer, "conversation_yes", getControlState ( source, "conversation_yes" ) ) setControlState ( specPlayer, "conversation_no", getControlState ( source, "conversation_no" ) ) setControlState ( specPlayer, "conversation_no", getControlState ( source, "conversation_no" ) ) setControlState ( specPlayer, "group_control_forwards", getControlState ( source, "group_control_forwards" ) ) setControlState ( specPlayer, "group_control_forwards", getControlState ( source, "group_control_forwards" ) ) setControlState ( specPlayer, "group_control_back", getControlState ( source, "group_control_back" ) ) setControlState ( specPlayer, "group_control_back", getControlState ( source, "group_control_back" ) ) setControlState ( specPlayer, "enter_exit", getControlState ( source, "enter_exit" ) ) setControlState ( specPlayer, "enter_exit", getControlState ( source, "enter_exit" ) ) --Vehicle Controls setControlState ( specPlayer, "vehicle_fire", getControlState ( source, "vehicle_fire" ) ) setControlState ( specPlayer, "vehicle_fire", getControlState ( source, "vehicle_fire" ) ) setControlState ( specPlayer, "vehicle_secondary_fire", getControlState ( source, "vehicle_secondary_fire" ) ) setControlState ( specPlayer, "vehicle_secondary_fire", getControlState ( source, "vehicle_secondary_fire" ) ) setControlState ( specPlayer, "vehicle_left", getControlState ( source, "vehicle_left" ) ) setControlState ( specPlayer, "vehicle_left", getControlState ( source, "vehicle_left" ) ) setControlState ( specPlayer, "vehicle_right", getControlState ( source, "vehicle_right" ) ) setControlState ( specPlayer, "vehicle_right", getControlState ( source, "vehicle_right" ) ) setControlState ( specPlayer, "steer_forward", getControlState ( source, "steer_forward" ) ) setControlState ( specPlayer, "steer_forward", getControlState ( source, "steer_forward" ) ) setControlState ( specPlayer, "steer_back", getControlState ( source, "steer_back" ) ) setControlState ( specPlayer, "steer_back", getControlState ( source, "steer_back" ) ) setControlState ( specPlayer, "accelerate", getControlState ( source, "accelerate" ) ) setControlState ( specPlayer, "accelerate", getControlState ( source, "accelerate" ) ) setControlState ( specPlayer, "brake_reverse", getControlState ( source, "brake_reverse" ) ) setControlState ( specPlayer, "brake_reverse", getControlState ( source, "brake_reverse" ) ) setControlState ( specPlayer, "radio_next", getControlState ( source, "radio_next" ) ) setControlState ( specPlayer, "radio_next", getControlState ( source, "radio_next" ) ) setControlState ( specPlayer, "radio_previous", getControlState ( source, "radio_previous" ) ) setControlState ( specPlayer, "radio_previous", getControlState ( source, "radio_previous" ) ) setControlState ( specPlayer, "radio_user_track_skip", getControlState ( source, "radio_user_track_skip" ) ) setControlState ( specPlayer, "radio_user_track_skip", getControlState ( source, "radio_user_track_skip" ) ) setControlState ( specPlayer, "horn", getControlState ( source, "horn" ) ) setControlState ( specPlayer, "horn", getControlState ( source, "horn" ) ) setControlState ( specPlayer, "sub_mission", getControlState ( source, "sub_mission" ) ) setControlState ( specPlayer, "sub_mission", getControlState ( source, "sub_mission" ) ) setControlState ( specPlayer, "handbrake", getControlState ( source, "handbrake" ) ) setControlState ( specPlayer, "handbrake", getControlState ( source, "handbrake" ) ) setControlState ( specPlayer, "vehicle_look_left", getControlState ( source, "vehicle_look_left" ) ) setControlState ( specPlayer, "vehicle_look_left", getControlState ( source, "vehicle_look_left" ) ) setControlState ( specPlayer, "vehicle_look_right", getControlState ( source, "vehicle_look_right" ) ) setControlState ( specPlayer, "vehicle_look_right", getControlState ( source, "vehicle_look_right" ) ) setControlState ( specPlayer, "vehicle_look_behind", getControlState ( source, "vehicle_look_behind" ) ) setControlState ( specPlayer, "vehicle_look_behind", getControlState ( source, "vehicle_look_behind" ) ) setControlState ( specPlayer, "vehicle_mouse_look", getControlState ( source, "vehicle_mouse_look" ) ) setControlState ( specPlayer, "vehicle_mouse_look", getControlState ( source, "vehicle_mouse_look" ) ) setControlState ( specPlayer, "special_control_left", getControlState ( source, "special_control_left" ) ) setControlState ( specPlayer, "special_control_left", getControlState ( source, "special_control_left" ) ) setControlState ( specPlayer, "special_control_right", getControlState ( source, "special_control_right" ) ) setControlState ( specPlayer, "special_control_right", getControlState ( source, "special_control_right" ) ) setControlState ( specPlayer, "special_control_down", getControlState ( source, "special_control_down" ) ) setControlState ( specPlayer, "special_control_down", getControlState ( source, "special_control_down" ) ) setControlState ( specPlayer, "special_control_up", getControlState ( source, "special_control_up" ) ) setControlState ( specPlayer, "special_control_up", getControlState ( source, "special_control_up" ) ) setControlState ( specPlayer, "enter_exit", getControlState ( source, "enter_exit" ) ) setControlState ( specPlayer, "enter_exit", getControlState ( source, "enter_exit" ) ) end addEvent( "toggleMoves", true ) addEventHandler( "toggleMoves", getRootElement(), togglePlayer ) Client local localPlayer = getLocalPlayer ( ) local rootElement = getRootElement ( ) addEventHandler ( "OnClientRender", rootElement, function ( ) if getElementData ( localPlayer, "specating" ) == true then triggerServerEvent ( "toggleMoves", localPlayer ) end end )
  19. A while ago, I started to make an ingame handling editor for MTA. As I where told, this functions should be available very soon at that time. But now it's already some months further, and it's still not available. So my question: where is it and when do we get it? I really wanna use my handling editor and share it with others
  20. You're right. It's only possible to retexture peds and weapons. Only vehicles and objects can be replaced with a new model and texture. Note that new vehicle collisions don't work and objects can be only replaced by another object. You can't add new objects, like it is possible for the SP.
  21. Satan, you're really the best mapper I know in this world. _O_
  22. Works, tnx And is it possible too to check the X, Y and Z where the player is looking at in (eg.) 3 units away?
  23. Hi, I'm searching a script to get the X, Y and Z in front of a vehicle. What I made until now, is only getting the X and Y in front of a vehicle, but it doesn't work. The object doesn't spawn. if getElementData ( source, "spawnedRamp" ) then destroyElement ( getElementData ( source, "spawnedRamp" ) ) setElementData ( source, "spawnedRamp", nil ) end local rX, rY, rZ = getVehicleRotation ( getPedOccupiedVehicle ( source ) ) outputChatBox ( "DEBUG: Vehicle=" .. getElementModel ( getPedOccupiedVehicle ( source ) ) ) local pX, pY, pZ = getElementPosition ( etPedOccupiedVehicle ( source ) ) pX = pX + ( 10 * math.sin ( -rZ ) ) py = py + ( 10 * math.cos ( -rZ ) ) local rampObject = createObject ( 1655, pX, pY, pZ, rX, rY, rZ ) -- This object doesn't spawn. Or atleast, I can't see it. setElementData ( source, "spawnedRamp", rampObject ) (Based out of this script of SA:MP's Pawn Language to get the X and Y points. I'm really not good in maths ) new Float:a; GetPlayerPos(playerid, x, y, a); GetPlayerFacingAngle(playerid, a); x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); But the problem is: I'm using my script in a Vehicle, and that object doesnt spawn. Problaby by a fault in the script. And I want to spawn that object in the air too, so I need the Z in front of the vehicle too.
  24. Collisions of vehicles are embedded into the DFF files, so loading a COL won't work. (Since there has never been a .col for a vehicle) EDIT to your edit: Yes, but collisions from cars do replace. (Atleast I got that feeling)
  25. I AM using the wiki. But this was just a little mistake in reading. Don't be mad But why are the collissions of custom planes and boats not working? Isn't that implemented yet? (I haven't found something about this)
×
×
  • Create New...