Jump to content

LoPollo

Members
  • Posts

    353
  • Joined

  • Last visited

  • Days Won

    3

LoPollo last won the day on December 5 2016

LoPollo had the most liked content!

1 Follower

Details

  • Location
    Italy

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

LoPollo's Achievements

Fool

Fool (23/54)

64

Reputation

  1. @TheMOG isn't it better to trigger the event to a player table and bind the client-side to root/localPlayer? UNTESTED I remember triggering events on root isn't a good thing (i've not been around for some time, correct me if wrong)
  2. @Disy notice that the string isn't finished: "Lobby 1 0/10 Bakkara Competetive "
  3. var getElementData ( element theElement, string key [, inherit = true] ) You probably want to do this: getElementData(someElement,someKey,false) since getElementData(someElement,someKey,true) === getElementData(someElement,someKey) hope i've been clear
  4. @NeXuS™ the default inherit is true, so if you don't want it you must NOT leave blank, you MUST pass false.
  5. Changed "true" with the default (true)? mmm i would suggest posting the code where you set the data (on connect) Also, you may add an outputchatbox that tells you the data value when the player gets damaged Another advice, it could be better not binding the event to root but to localPlayer (so every player won't use it on other players, since they will have their own clientside script doing it)
  6. I can't understand.... Don't forget to report any error/warning you get, and if there are no errors to report then say explicitly that there are no errors.
  7. onResourceStart When a resource starts, the handler of that start will pass the passed resource as first parameter. There's no player to work with. You may want to loop all players and set the stats. Note that setPlayerStat is deprecated. Regarding setElementHealth, just to make sure you know: it will set the current HP, not the "stat" of health. Looking at the 2nd example of setPedStat can help you dealing with health values depending on variable max health stat.
  8. There's one more parameter you could be interested in: onVehicleStartEnter player enteringPlayer, int seat, player jacked, int door
  9. I changed thePlayer -> thePlayerName, and then added thePlayer as player-type variable. There was a variable called "p", that i couldn't find in the code, so i replaced with the name of the player. I also replaced the table concats... yet i don't know what you want to do with them so maybe it's better to re-use the old code. function setAdminRanks(theAdmin, cmd, thePlayerName, rank) local acc = getAccountName(getPlayerAccount(theAdmin)) local thePlayer = getPlayerFromName( thePlayerName ) --replace the name (a string) with the player element if not thePlayer then outputChatBox( "Syntax error: \""..thePlayerName.."\" was not found.") return end local account = getAccountName(getPlayerAccount(thePlayer)) if not rank then outputChatBox( "Syntax error: rank was not specified.") return end --I'm replacing here something that could be the equivalent of what you were doing. Is it right? If not replace with the old code local dev = rank.."dev"--local dev = table.concat({rank}, "dev") local helper = rank.."helper"--local helper = table.concat({rank}, "helper") local moderator = rank.."mod"--local moderator = table.concat({rank}, "mod") local admin = rank.."admin"--local admin = table.concat({rank}, "admin") if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end if isObjectInACLGroup("user."..acc, aclGetGroup("Administrator")) then if account then if dev then --p was undefined here aclGroupAddObject (aclGetGroup("Mapper"), "user."..account) outputChatBox("AdmCmd: You have set "..thePlayerName.."'s staff rank to Developer!", theAdmin, 0, 255, 0) aclGroupAddObject (aclGetGroup("Staff"), "user."..account) outputChatBox("AdmCmd: "..getPlayerName(theAdmin).." has set your staff rank to Developer!", thePlayer, 0, 255, 0) Note: I did not closed the function. Also i did not check if types are correct with acl functions, since i don't remember them... If there are error, wiki will help you fix them in nanoseconds, otherwise reply here. As always, code was not tested.
  10. other is not a valid player name, so local otherPlayer = getPlayerFromName(other) is false, so getPlayerMoney(otherPlayer) + amount is getPlayerMoney(false) + amount, which should also throw a warning. Just checked really fast, so i'm sorry if i said something wrong.
  11. HelloWorld(ArgumentsHere) The arguments are the data processed by the function. You mentioned functions with a parameter called "thePlayer". The name suggests* that the function accept a player-type variable, and therefore performs actions on that player/using that player data. *Suggest: Arguments names are just something to recognise that parameter. It's not a type or whatever. If you called that "foo" or "someVariableNameChosenRandomly" and rename all the reference of that variable inside the function then no difference is made. Names are used to let humans understand easily the code. This is not a MTA question, so searching this on google about LUA (or every other programming/scripting language actually) will give you the info you need. Boolean is a variable type. It can store information in only 2 state: true and false. In LUA, false is represented by the false-values: false and nil. Every other value is considered true. This question is also not MTA related. You can have further informations using google with a general language. Reading errors and warning produced from the scripts is the first thing to do to "fix" and debug. The first warn tells you that argument 1 used in getPlayerAccount is nil. If you didn't pass nil, then you probably are calling this function without the rigth parameters (leaving them undefined -> nil) Probably this is a command handler (given the parameter names). In this case the passed player will be a string, and not a player-type variable. The warn 2, since the first function fails and returns false (boolean), is here to let you know that the same problem happened here: an account-type var was expected, instead false was passed. function setAdminRanks(theAdmin, cmd, thePlayerName, rank) local thePlayer = getPlayerFromName( thePlayerName ) if not thePlayer then --if getPlayerFromName returned false then no player with that name was found return --"kill" the function end local accountName = getAccountName(getPlayerAccount(thePlayer)) --do whatever you need, remember that rank parameter could be nil (unspecified) end
  12. @2kristof2... what koragg said is valid, but the fact the archive can't be writted (edited) makes me thing the server is running and is using that resource (have some file of it open) Check the script when you can to make sure everytime you open a file you also close it. EVERYTIME you open: you close in EVERY case. That could be why the server keeps some file opened. (to edit the resource you may need to start/stop/restart multiple time, or shutdown the server)
  13. There's something weird car= getPedOccupiedVehicle ( thePlayer ) if isPedInVehicle( thePlayer ) then --this generates warning but getPedOccupiedVehicle don't??? are you sure this is the correct line? Also: Expected bool at argument 5 Copying pasting from wiki the 5th arg serverside is int b=176 so an integer. The correct syntax (for your clientside script) is: bool outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] )
  14. Did you try to change drag? Also note that helicopters and boats use additional handling data, which is not editable with MTA functions, so if some "limits" are in that code... Note: i'm not an handling expert and probably other more experienced people can give you further help with this.
×
×
  • Create New...