Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. I've edited my post, try that (is server side).
  2. I would use onPlayerDamage server side instead. function damagestars ( attacker, weapon, bodypart, loss ) local model = getElementModel(attacker) if (model ~= 280 and model ~= 284) then local wlevel = tonumber(getElementData(attacker, "Wanted-Level")) setElementData(attacker, "Wanted-Level", wlevel+1) end end addEventHandler ( "onPlayerDamage", root, damagestars )
  3. Castillo

    Dude here! (2)

    Don't double post. P.S: You're welcome.
  4. Castillo

    Dude here! (2)

    addEventHandler("onClientPlayerDamage",localPlayer, function () local x, y, z = getElementPosition(source) local zone = tostring(getZoneName ( x, y, z, false )) if (zone ~= "Restricted Area" and zone ~= "Mount Chiliad") then cancelEvent() end end)
  5. Castillo

    Skin

    You must save the skin before jail him, then load it. function getPlayerFromPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function Jail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end setElementData(thePlayer, "jailSkin", getElementModel ( thePlayer )) setElementModel ( thePlayer, 4 ) setElementPosition ( thePlayer, 52, 2483, 21 ) takeAllWeapons ( getRootElement() ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) else outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) end end addCommandHandler("jail",Jail) function Unjail (player, command, name) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(name) if not thePlayer then return end if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end setElementPosition ( thePlayer, 72, 2484, 16.3 ) setElementModel ( thePlayer, tonumber(getElementData(thePlayer,"jailSkin"))) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) else outputChatBox ("You cannot unjail yourself!", player, 255, 0, 0, true ) end end addCommandHandler("unjail",Unjail) ped1inside = createPed ( 71, 69, 2503, 17) setElementFrozen (ped1inside, false ) setPedRotation (ped1inside, 180)
  6. No, If I'm right, you can't store tables, but, you can store JSON strings.
  7. In my opinion, he already know that.
  8. Charlie, that makes no sense... what kind of settings is he doing?
  9. We can't know what are you trying to do... can you please explain yourself further?
  10. getElementPosition returns 3 integers, not just one. function onServerLeave () local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playermoney = getPlayerMoney ( source ) setAccountData ( playeraccount, "data.money", playermoney ) local playerjob = getElementData ( source, "Job" ) setAccountData ( playeraccount, "data.job", playerjob ) local x, y, z= getElementPosition ( source ) local playerpos = x ..",".. y ..",".. z setAccountData ( playeraccount, "data.pos", playerpos ) end end function onServerJoin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "data.money" ) if ( playermoney ) then setPlayerMoney ( source, playermoney ) local playerjob = getAccountData ( playeraccount, "data.job" ) if ( playerjob ) then setElementData ( source, "Job", playerjob ) local playerpos = getAccountData ( playeraccount, "data.pos" ) if ( playerpos ) then setElementPosition ( source, unpack(split(playerpos, ",")) ) end end end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onServerLeave ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onServerJoin )
  11. local updateTimers = {} addEventHandler ( "onPlayerJoin", getRootElement(), function () updateTimers[source] = setTimer(function (player) setElementData(source,"port",getServerPort(player)) setElementData(source,"s",getServerName(player)) setElementData(source,"fps",getFPSLimit(player)) setElementData(source,"map",getMapName(player)) setElementData(source,"ping",getPlayerPing(player)) setElementData(source,"vr",getPlayerVersion(player)) setElementData(source,"ips",getPlayerIP(player)) setElementData(source,"srs",getPlayerSerial(player)) setElementData(source,"money",getPlayerMoney(player)) setElementData(source,"name",getPlayerName(player)) end,1000,0, source) end) addEventHandler("onPlayerQuit",root, function () if isTimer(updateTimers[source]) then killTimer(updateTimers[source]) end end)
  12. But, if you keep restarting the resource when it starts, it'll end into a loop...
  13. addEventHandler ( "onResourceStart",getRootElement() , function(res) if tostring(getResourceName ( res )) == "scoreboard" then restartResource (res) end end) You we're trying to restart the resource from where that script is executed, not the resource that just started.
  14. Well, if you are willing to save a lot of information, then it can be a problem in future, as the file will be too big, and may take a some time to read it when needed. Why not use SQLITE functions? or mysql.
  15. CLIENT. addEvent("Zomb_STFU",true) addEventHandler("Zomb_STFU",root, function ( zomb ) triggerServerEvent ( "onZombieSpawned", zomb ) end) SERVER: local weaponsTable = {2, 3, 4, 5, 6, 7, 8, 9, 15 } addEvent("onZombieSpawned",true) addEventHandler("onZombieSpawned",root, function ( ) giveWeapon ( source, math.random(#weaponsTable), 1, true ) end)
  16. Yes, that's the same thing I'd, you should read the posts above, John. P.S: I think Slothman should put the source as the ped.
  17. Castillo

    huh?

    You can try creating a table and setting new index to each object.
  18. Castillo

    huh?

    Does it work now? each vehicle has a "spatula"?
×
×
  • Create New...