-
Posts
353 -
Joined
-
Last visited
-
Days Won
3
Everything posted by LoPollo
-
I think "musuh" is the player name?
-
Ok it didn't work for me either and did not see any error... but found the problem: when working with the experience data and outputchatboxes from line 10 to line 27 there's an undefined variable: "player". it should be "attacker" instead. If you are lazy you can define that variable inserting at line 4: local player = attacker Note: i used a modified version of the script, to triggers events via command, letting me setting the attacker and source, also beign alone in the server made me use some checks in the script to "simulate" the behaviour of the script with different players. So event it was tested it's better to test in a real environment, with more players.
-
but cancelling the weapon switch will also cause the inability to reach the other weapons "scrolling" in that direction I would suggest replacing the cancelEvent with a setPedWeaponSlot to simply let "skipping" the weapon instead of blocking... that will require some work through No don't worry, the wiki example was using it because the example outputs the weapon a random player is holding.
-
It's strange it does not work, through i did not test it. Are there errors clientside? I'm going to test ASAP Update: It works for me, i used @iPrestege code. No errors and both on foot and inside veh trigger the teleport
-
i edited the post above for the functions you can use to solve that problem. if the current weapon is 42 toggle the control "fire" to false if the previous weapon is 42 toggle the control "fire" to true EDIT: keep in mind that usign the client side event will not give you the weapon ID, but the slot. Use getPedWeapon to retrieve the weapon ID knowing the slot
-
The (untested) fixed script is here, but make sure you understand the fix otherwise next time you will have to start from 0 with a similar problem Note that i'm assuming that isPlayerVIP returns a boolean since you didn't negate it when i said it, but following the logic that's how it should be local laserColor = { [true]={255, 0, 0}, [false]={255, 100, 0} } addCommandHandler("laser", function (thePlayer) if not exports["(T-RPG)VIP"]:isPlayerVIP(getAccountName(getPlayerAccount(thePlayer))) then return end local isVip = exports["(T-RPG)VIP"]:isPlayerVIP(thePlayer) setElementData( thePlayer, "laser.on", not getElementData( thePlayer, "laser.on" ) ) setElementData(thePlayer, "laser.aim", false) exports["(T-RPG)Info"]:sendMessage( thePlayer, "Laser: the laser is now ".. ( getElementData( thePlayer, "laser.on" ) and "enabled" or "disabled") ..".", unpack(laserColor[isVip])) end ) I highlight it's untested, tell us if it works if you have time. I'm not sure if i understand: do you mean "disable" that weapon? so even if you have fire extinguisher you can't shoot with it? If so you can use these: --server event "onPlayerWeaponSwitch" --client event "onClientPlayerWeaponSwitch" toggleControl --control name: "fire"
-
About the outputChatBox i understand more or less the meaning, but something like this could be better? You can't be shot less than 2 minutes ago in order to use this function! to You must get no damage for 2 straight minutes to use the slap function but yeah it would be better to place it when trying to slap BUT the 2m are not passed yet I think it's for debug and it will be removed once the script is finished so it's not a real problem Well... there's the script. I removed the timer from the slap, and... well check it local aTimer = { } function slap ( ) if isTimer ( aTimer[source] ) then --if the player got damage in the last 2 minutes then do not let he slap --outputChatBox( "You got damage in the last 2 minutes, you can't use this!", source) return end local x,y,z = getElementPosition ( source ) setElementPosition ( source,x,y,z+5 ) end addEvent( "slap",true ) addEventHandler( "slap", root, slap ) function playerDamage_text ( attacker, weapon, bodypart, loss ) if attacker then if isTimer( aTimer[source] ) then --he got damage in the last 2 minutes, reset the timer resetTimer(aTimer[source]) else --he did NOT got damage in the last 2 minutes, so he now has and the timer starts aTimer[source] = setTimer ( function( thePlayer ) --"thePlayer is the element passed" aTimer[thePlayer] = nil end, 120000, 1, source ) --source is passed to the timer function as "thePlayer" end end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) I hope i did not forgot anything and did not make errors, so let us know if this work Remember to set the right source element when triggering the event "slap"
-
What i said does NOT fix the errors above. What i said is about the fact the killstreak is not resetted: you set to false some data of an element, but actually you store the killstreak in a table, not on the element itself. --this is you func i was talking about: function resetKillingstreak (player) local killstreaks = getElementData( player, "killstreaks" ) if tonumber( killstreaks ) then if ( killstreaks >= 0 ) then --They have a killingstreak higher than 0 --We will want to reset the element data back to its default (that being false) setElementData ( player, "killstreaks", false ) end else return end end --but actually you store the data in local killstreaks = {} --so the function should work on that: function resetKillingstreak () local player = source --it's not the first parameter, it is the source! --local killstreaks = killstreaks[player] if killstreaks[player] and ( killstreaks[player] > 0 ) then --if the killstreak exists (it may be nil) and it's higher than 0 --They have a killingstreak higher than 0 --We will want to reset the element data back to its default (that being false) killstreaks[player] = 0 --set it to 0 end end About the errors posted above, it's because you are trying to use a false value as a number: getElementData returns false if the data or the element itself does not exists since you are trying to get data that was never setted, it does not exists and the getElementData returns false In the next line you add 1 to that value (that should be a number, but as explained it's false instead) and so it fails. So to fix this you should handle the data that does not exist. The easiest way it to add an "or 0" when settin the variable: in case the function before the "or" returns a false value (false or nil) the value after the or is used instead: in your case it will be set to 0 instead with this fix, and not false if the get data return false. --replace local exp = getElementData(player, "experience") --with local exp = getElementData(player, "experience") or 0 You should replace this everytime the function is called and it may return false. Since you are only increasing that value by 1, you can only add the "or 0" on line 11 Hope i've been clear, let us know if it works also good luck with learning lua
-
function playerDamage_text ( attacker, weapon, bodypart, loss ) --You do not need to know where the player got damaged (i'm talking about bodypart) if attacker then --if the player got damage from a player, that parameter is the attacker player. Flase otherwise if isTimer( aTimer[source] ) then --you also need to check if the 2 minutes are still ongoing --the check was made also to make sure the argument of resetTimer is valid resetTimer(aTimer[source]) --aTimer is the table, actually you need the timer outputChatBox ( "You can't be shot less than 2 minutes ago in order to use this function!", getRootElement (), 255, 0, 0 ) --actually i don't understand the meaning of the message but it's ok XD end end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) --root = getRootElement(), take a look to predefined variables I made some changes to the code, but you are facing the right direction! Try this and let me know if it's working or if i forgot something
-
reset the timer when the a player get damaged by another player
-
Is it the handler of onPlayerWasted? cause the player is not the first parameter but the source of the event if i remember right EDIT: why are you resetting the elementData of the player to false if you store the data in a table that doesn't make any sense. Let us know if it's working
-
I was trying to understand the code but i gave up since i have no much time right now... there's client logic inside a server side script... i'm talking about the first variables like currentSkin, currentTeam... also you are forcing with tostring something that will be for sure a string (you set it in the script and it'is not touched otherwise, so if you set it only as string it will be always a string ) also rename some variables, like "k", i think stands for key... but k is a common variable in for loops, and even if that's not the case this practice can lead to errors. And me to not understand other variables to rename are team and player. Another thing to be aware is that in deathChangeTeam you are adding an handler, which will be added and added and added and added, everytime the function is called. This handler is also bound to root, but you are using "if source == player then" so what about binding it directly to what you need to check? (the player) I think it's better to rewrite some parts of the script, using tables when needed Ignore below, it's just the script correctly tabbed with the very first questions that passed in my mind...
-
I think it too but just in case there's more... also the advice is still valid, next time you ask for help copy and paste the error if present, and if not present say there's not. If you don't say anything we don't know if you are omitting or there's nothing to say about it cause there's no error.
-
Wow i though there were much more choice, actually you are right.. dunno i never enjoyed rp https://github.com/mabako/mta-paradise https://forum.multitheftauto.com/topic/39149-rel-mta-paradise-roleplay-11b/ there are a few around but not too many...
-
If you export it shouldn't the enviroment of that function still be the resource that export the function itself? (because i'm sure it's like that) or the problem is it has a parameter bound to the sql db? or was just an example? EDIT: ops i think i now understand: you need an equivalent of that func of gcshop from the admin panel or buyscript. Did i understand right?
-
Can't you export it? edit the meta of that resource And how are you showing the votemanager? by using executeCommandHandler? i don't even remember if there was a command...
-
Did you try looking in the community? There's for sure something, there must be something
-
Post what edits you made if you can, it could be useful for who have your same porblem
-
If the client was running see Also there are other methods https://wiki.multitheftauto.com/wiki/Debugging#Server_.26_client_debug_logging see the first
-
I don't get the sense of that answer without a question... so i'm making some to understand better: Q1. Do you have modded vehicles models in your gta3.img? Q2. Do you play in a server that has these kind of mods? Q3. Do you lag without any vehicle mods (both u and server have no mods of that kind)? A1. Remove the mods and restore gta3.img to it's orginal. A2, Do not play in this server or read what @koragg said and use the carhider A3. Read what @koragg said and use the carhider The last hard "question" may be Q4. What if i still lag after the above? But this is not even a question since you said "when many car in the near me". Still the answer is: A4. Do not play MTA since you must be under the minimum requirements, there's nothing you can really do other than upgrading your HW as @loki2143 suggested I really can't see what got left behind...
-
The error says all. well... don't you have an hex editor? if not you can download one like HXD and pasting the hex code in a new blank file, otherwise take the script, set the priority on high (or still above normal - default priority) to the handler of deaths, and timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 20000, 1, theVehicle ) --replace to local theVehicle = pedsOccupiedVehicles[source] timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 20000, 1, theVehicle )
-
@[NIG]MKH you can, but it's a sort of workaround, also you don't know if there are other "events" showing it again The best thing is to do as @iPrestege said