Jump to content

Linttamummo

Members
  • Posts

    8
  • Joined

  • Last visited

Linttamummo's Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. Whole edit of message: So, i tried to do some version of police script with "jail" and timer, and it looks like this. Fix something if I made mistake function createTeamsOnStart ( ) poliisi1 = createTeam ( "Poliisi", 0,0,255 ) end addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) function kytta ( thePlayer ) local level = getPlayerWantedLevel ( thePlayer ) if ( level > 0 ) then outputChatBox ( "Sinulla on Wanted tähtiä, joten et voi olla poliisi.", thePlayer, 255,0,0 ) return else outputChatBox ( "Tervetuloa työvuorollesi. Turvallista matkaa.", thePlayer, 0,0,255 ) setPlayerTeam ( thePlayer, poliisi1 ) setPlayerNametagColor ( thePlayer, 0,0,255 ) spawnPlayer ( thePlayer, -1606, 675, -5 ) setElementModel ( thePlayer, 280 ) takeAllWeapons ( thePlayer ) giveWeapon ( thePlayer, 3, 1 ) giveWeapon ( thePlayer, 22, 250 ) giveWeapon ( thePlayer, 25, 100 ) giveWeapon ( thePlayer, 29, 125 ) giveWeapon ( thePlayer, 31, 125 ) giveWeapon ( thePlayer, 41, 2000 ) end end addCommandHandler ( "poliisi", kytta ) function pidattaminen (attackerweapon, poliisi, bodypart) local poliisi = attacker local uhri = source local tahti = getPlayerWantedLevel ( source ) if ( tahti > 0 ) then getElementType ( source, "uhri" ) if (poliisi) and (attackerweapon == 3) then if getTeamName( theTeam ) == "Poliisi" then setPedFrozen ( source, frozen ) setElementInterior (source, 6, 264, 78, 1002) setElementDimension (source, 1) local timer = setTimer ( source, 120000, 1 ) if isTimer ( timer ) then killTimer ( timer ) setElementInterior (source, nil, 1544, -1670, 14) setElementDimension (source, 0) setPedFrozen ( source, not frozen ) setPlayerWantedLevel ( source, 0 ) end end end end end addEventHandler ( "onPlayerDamage", getRootElement (), pidattaminen )
  2. Hi. I made police job system, that I type /poliisi, I spawn as a police in SFPD. It worked well, I mean that spawn without arrest functions. But when i add those arrest functions onto it, it stopped to work. I dont know where is problem, but here is the server.lua: function createTeamsOnStart ( ) poliisi1 = createTeam ( "Poliisi", 0,0,255 ) end addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) function kytta ( thePlayer ) local level = getPlayerWantedLevel ( thePlayer ) if ( level > 0 ) then outputChatBox ( "Sinulla on Wanted tähtiä, joten et voi olla poliisi.", thePlayer, 255,0,0 ) return else outputChatBox ( "Tervetuloa työvuorollesi. Turvallista matkaa.", thePlayer, 0,0,255 ) setPlayerTeam ( thePlayer, poliisi1 ) setPlayerNametagColor ( thePlayer, 0,0,255 ) spawnPlayer ( thePlayer, -1606, 675, -5 ) setElementModel ( thePlayer, 280 ) takeAllWeapons ( thePlayer ) giveWeapon ( thePlayer, 3, 1 ) giveWeapon ( thePlayer, 22, 250 ) giveWeapon ( thePlayer, 25, 100 ) giveWeapon ( thePlayer, 29, 125 ) giveWeapon ( thePlayer, 31, 125 ) giveWeapon ( thePlayer, 41, 2000 ) end end addCommandHandler ( "poliisi", kytta ) function pidattaminen ( pidattaja, weapon, bodypart, loss ) if (pidattaja) and (weapon == 3) then if getElementParent (pidattaja) == poliisi1 then local maija = pidattaja local vanki = source local tahti = getPlayerWantedLevel ( source ) if (getElementData ( vanki, "currentstatus" ) ~= "pidatetty") and (tahti > 0) then if (getElementData ( pidattaja, "currentarrests" ) ~= "single" ) and (getElementData ( pidattaja, "currentarrests" ) ~= "double" ) then setElementData ( maija, "currentarrests", "single" ) triggerClientEvent(maija,"copdirections",maija) elseif (getElementData ( pidattaja, "currentarrests" ) == "single" ) then setElementData ( maija, "currentarrests", "double" ) end setElementData ( vanki, "currentstatus", "pidatetty" ) setElementData ( vanki, "captor", maija ) showCursor ( source, true ) toggleAllControls ( source, false, true, false ) walktheprisoner ( maija, vanki ) setElementData ( vanki, "arrestTimeout", setTimer ( freetheguy, 180000, 1, vanki )) end end end end addEventHandler ( "onPlayerDamage", getRootElement (), pidattaminen ) function yankhimout(player, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == poliisi1 then local tahti = getPlayerWantedLevel( player ) if tahti > 0 then if (getElementData ( jacker, "currentarrests" ) ~= "single" ) and (getElementData ( jacker, "currentarrests" ) ~= "double" ) then local maija = jacker local vanki = player setElementData ( vanki, "currentstatus", "pidatetty" ) setElementData ( vanki, "captor", maija ) setElementData ( maija, "currentarrests", "single" ) triggerClientEvent(maija,"copdirections",maija) showCursor ( vanki, true ) toggleAllControls ( vanki, false, true, false ) walktheprisoner ( maija, vanki ) setElementData ( vanki, "arrestTimeout", setTimer ( freetheguy, 180000, 1, vanki )) elseif (getElementData ( jacker, "currentarrests" ) == "single" ) then local maija = jacker local vanki = player setElementData ( vanki, "currentstatus", "pidatetty" ) setElementData ( vanki, "captor", maija ) setElementData ( maija, "currentarrests", "double" ) showCursor ( vanki, true ) toggleAllControls ( vanki, false, true, false ) walktheprisoner ( maija, vanki ) setElementData ( vanki, "arrestTimeout", setTimer ( freetheguy, 180000, 1, vanki )) end end end end end addEventHandler ( "onVehicleExit", getRootElement(), yankhimout ) function walktheprisoner(maija, vanki) if (getElementData ( vanki, "currentstatus" ) == "pidatetty") and (getPedOccupiedVehicle ( vanki ) == false ) then local copx, copy, copz = getElementPosition ( maija ) local prisonerx, prisonery, prisonerz = getElementPosition ( vanki ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( vanki, copangle ) setCameraTarget ( vanki, vanki ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist > 16 ) then freetheguy ( vanki ) --FREES PRISONER IF HE GETS FAR AWAY elseif ( dist > 12 ) then setControlState ( vanki, "sprint", true ) setControlState ( vanki, "walk", false ) setControlState ( vanki, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, maija, vanki ) elseif ( dist > 6 ) then setControlState ( vanki, "sprint", false ) setControlState ( vanki, "walk", false ) setControlState ( vanki, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, maija, vanki ) elseif ( dist > 1.5 ) then setControlState ( vanki, "sprint", false ) setControlState ( vanki, "walk", true ) setControlState ( vanki, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, maija, vanki ) elseif ( dist < 1.5 ) then setControlState ( vanki, "sprint", false ) setControlState ( vanki, "walk", false ) setControlState ( vanki, "forwards", false ) local zombify = setTimer ( walktheprisoner, 500, 1, maija, vanki ) end end end function freetheguy (vanki) local thecaptor = (getElementData ( vanki, "captor" )) setElementData ( vanki, "currentstatus", "none" ) setElementData ( vanki, "captor", "none" ) showCursor ( vanki, false ) setControlState ( vanki, "sprint", false ) setControlState ( vanki, "walk", false ) setControlState ( vanki, "forwards", false ) toggleAllControls (vanki, true) local prisonercheck = setTimer ( checkforprisoners, 1500, 1, thecaptor ) TimoutTimer = (getElementData ( vanki, "arrestTimeout" )) if isTimer(TimoutTimer) then killTimer(TimoutTimer) setElementData ( vanki, "arrestTimeout", nil) TimeoutTimer = nil end end function checkforprisoners(maija) if isElement(maija) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == maija ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( maija, "currentarrests", "none" ) triggerClientEvent( maija,"clearcopdirections",maija) elseif prisoners == 1 then setElementData ( maija, "currentarrests", "single" ) elseif prisoners == 2 then setElementData ( maija, "currentarrests", "double" ) end end end function cheatescape (playerSource) freetheguy ( playerSource ) setPlayerWantedLevel( playerSource, 0 ) end addCommandHandler ( "minaolenvanki", cheatescape ) ]] function someonedied( ammo, pidattaja, weapon, bodypart ) local tahti = getPlayerWantedLevel( source ) if tahti > 0 then if isElement(pidattaja) then if getElementParent(pidattaja) == poliisi1 then local Kreward = get("legalsystem.Kreward") local thisreward = tahti*Kreward givePlayerMoney ( pidattaja, thisreward ) -- REWARDS A KILL IF THE PLAYER HAS A WANTED LEVEL end end end if (getElementData ( source, "currentstatus" ) == "pidatetty") then freetheguy ( source ) --IF A PRISONER DIES, FREES THEM FOR RESPAWN end if (getElementData ( source, "currentarrests" ) == "single" ) or (getElementData ( source, "currentarrests" ) == "double" ) then setElementData ( source, "currentarrests", "none" ) local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == source ) then freetheguy ( thePlayer ) --IF A COP DIES, FREES ALL HIS PRISONERS end end end end addEventHandler ( "onPlayerWasted", getRootElement(), someonedied ) function playergotout( player, seat, jacker ) if isElement(jacker) then if (getElementData ( player, "currentarrests" ) == "single" ) or (getElementData ( player, "currentarrests" ) == "double" ) then local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == player ) then freetheguy ( thePlayer ) end end end end end addEventHandler ( "onVehicleExit", getRootElement(), playergotout ) function aplayerleft() if (getElementData ( source, "currentarrests" ) == "single" ) or (getElementData ( source, "currentarrests" ) == "double" ) then local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == source ) then freetheguy ( thePlayer ) -- IF A COP DISCONNECTS, FREES HIS PRISONERS end end end end addEventHandler ( "onPlayerQuit", getRootElement(), aplayerleft ) function copcarenter (vehicle, seat, jacked ) local carid = getElementModel( vehicle ) if carid == 598 or carid == 596 or carid == 597 or carid == 427 or carid == 490 then if getElementParent(source) == poliisi1 then if (getElementData ( source, "currentarrests" ) == "single" ) or (getElementData ( source, "currentarrests" ) == "double" ) then local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == source ) then local copx, copy, copz = getElementPosition ( source ) local prisonerx, prisonery, prisonerz = getElementPosition ( thePlayer ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist < 6 ) then if (getVehicleOccupant ( vehicle, 2 ) == false) then warpPedIntoVehicle ( thePlayer, vehicle, 2 ) elseif (getVehicleOccupant ( vehicle, 3 ) == false) then warpPedIntoVehicle ( thePlayer, vehicle, 3 ) end end end end end end elseif carid == 599 then if getElementParent(source) == poliisi1 then if (getElementData ( source, "currentarrests" ) == "single" ) or (getElementData ( source, "currentarrests" ) == "double" ) then local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == source ) then local copx, copy, copz = getElementPosition ( source ) local prisonerx, prisonery, prisonerz = getElementPosition ( thePlayer ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist < 6 ) then if (getVehicleOccupant ( vehicle, 2 ) == false) then warpPedIntoVehicle ( thePlayer, vehicle, 1 ) end
  3. Yeah got it. One more, i want the police team with the server.lua that castillo fixed, but it doesnt need ACL, so anyone can play as "police" with command /police. I can add spawn and weapons, but I dont know how to script the arrest with nightstick
  4. The script that i want to is like that: When you type /leave, the command kicks you out of current team. You cant go out of team without anything like that. Its perfect for playing "offduty" without gang team . So it just kick you out of current team, then team is nil / no one. You are example on team "Admins" You want to play offduty, but you cant do that. You can only remove yourself out of team with adminpanel. So i want command that anyone can use to remove himself out of the current team. sorry bad english
  5. Hi, your script that you made for me was awesome. But here is one thing that i want to change. It is that godmode, I want this script without it, but I cant do it, it fails always. The point I mean on this, is that I want to create new team without godmode, like the team that can be used for a gangs. Here is my version, but I don't know where is the fail: function createTeamsOnStart ( ) teamstaff = createTeam ( "AMIS", 226,8,246 ) end addEventHandler ( "onResourceStart", resourceRoot, createTeamsOnStart ) function togglestaffMode ( thePlayer ) local account = getPlayerAccount ( thePlayer ) if ( not account or isGuestAccount ( account ) ) then outputChatBox ( "Pääsy estetty.", thePlayer, 226,8,246 ) return end local accountName = getAccountName ( account ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "amis" ) ) ) then outputChatBox ( "SPAWNASIT JUURI AMIKSEKSI.", thePlayer, 226,8,246 ) setPlayerTeam ( thePlayer, teamstaff ) setPlayerNametagColor ( thePlayer, 226,8,246 ) spawnPlayer ( thePlayer, 1460, 2779, 11 ) setElementModel ( thePlayer, 29 ) giveWeapon ( thePlayer, 5, 1 ) giveWeapon ( thePlayer, 22, 250 ) giveWeapon ( thePlayer, 25, 100 ) giveWeapon ( thePlayer, 32, 215 ) giveWeapon ( thePlayer, 34, 15 ) end addCommandHandler ( "amis", togglestaffMode ) and the other thing that I want to have, is to leave the team back to as a "freeroam" team, so then thePlayer is not in any team. addCommandhandler would be /leaveteam. Thanks for you guys from big help, big thanks for Castillo!
  6. but thats the problem, everyone can use it, even the guys that plays as guest.. I dont know whats the problem
  7. hi, i have bug on my admingodmode bug. when i do "/gostaff", everything goes well. But here is one problem, that the everyone can use this command, not only admins. I want this to work, but here is everytime this bug.. So, help me please ! server.lua: function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("god mode off",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("god mode on",thePlayer,255,255,255) end end end addCommandHandler("gostaff",togglestaffMode) server1.lua: function createTeamsOnStart () teamstaff = createTeam ( "Admins", 255, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function lol ( player, command ) setPlayerTeam ( player, teamstaff ) setPlayerSkin(player, 217) giveWeapon (player, 38, 9999) giveWeapon (player, 8, 1) end addCommandHandler ( "gostaff", lol )
  8. Hi, I just created own MTA server. But, here is just one problem that is impossible to solve without help. Like I said in subject, example I enter on game. Here is the map on the screen, that you can warp yourself anywhere the map you want. I double click on the "map", everything goes normal, screen goes black, but then it stays black. It doesnt teleport me anywhere. Tried to reinstall MTA, tried many settings, but nothing helps. Still, you can give me some hint if its problem with settings somewhere. This is so annoying bug/problem. I have own computer for server. Computer haves Windows xp professional, and sp3. I don't run exe's with compatibility mode. What could be wrong? Help me. I'm cloud for everyone who can help me.
×
×
  • Create New...