Jump to content

Hope You Help me :'(


Best-Killer

Recommended Posts

Hello Guys ,

I Have Nerd Gaming GameMode and i want change jail pos ...ect now it's when player arrest cop he need go to LS marker for the player warpet to jail and when release he's Released Only in LS too

i want it : when cop arrest player the marker showed in the pos LS ,LV,SF ...ect and if the cop go to marker of LV then the criminal released in LV (the pos what i did)

Really i need help on that guys i Never have idea to change it

pls give me idea to change or do that for me and thanks so much please guys :/

local WARP_LOCS = {  
    DEFAULT = { }, 
    ADMIN = { }, 
    RELEASE = { } 
} 
  
addEventHandler ( "onResourceStart", resourceRoot, function ( ) 
     
    local warp_default = get ( "*JAIL_WARP_LOCATION" ); 
    local warp_admin = get ( "*JAIL_WARP_ADMIN_LOCATION" ); 
    local warp_release = get ( "*JAIL_WARP_RELEASE_LOCATION" ); 
     
    if ( not warp_default ) then  
        outputDebugString ( "Couldn't find '*JAIL_WARP_LOCATION' setting in SAEGPolice" ); 
        WARP_LOCS.DEFAULT = { 0, 0, 0 } 
    else  
        local warp_default = split ( warp_default, "," ); 
        if ( #warp_default ~= 3 ) then  
            outputDebugString ( "'*JAIL_WARP_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); 
            WARP_LOCS.DEFAULT = { 0, 0, 0 } 
        elseif ( not tonumber ( warp_default[1] ) or not tonumber ( warp_default[2] ) or not tonumber ( warp_default[3] ) ) then  
            outputDebugString ( "Failed to convert all '*JAIL_WARP_LOCATION' coordinates to floats. Please confirm they are numbers" ); 
            WARP_LOCS.DEFAULT = { 0, 0, 0 } 
        else  
            WARP_LOCS.DEFAULT = { tonumber(warp_default[1]), tonumber(warp_default[2]), tonumber(warp_default[3]) }; 
        end  
    end  
     
    if ( not warp_release ) then  
        outputDebugString ( "Couldn't find '*JAIL_WARP_RELEASE_LOCATION' setting in SAEGPolice" ); 
        WARP_LOCS.RELEASE = { 0, 0, 0 } 
    else  
        local warp_release = split ( warp_release, "," ); 
        if ( #warp_release ~= 3 ) then  
            outputDebugString ( "'*JAIL_WARP_RELEASE_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); 
            WARP_LOCS.RELEASE = { 0, 0, 0 } 
        elseif ( not tonumber ( warp_release[1] ) or not tonumber ( warp_release[2] ) or not tonumber ( warp_release[3] ) ) then  
            outputDebugString ( "Failed to convert all '*JAIL_WARP_RELEASE_LOCATION' coordinates to floats. Please confirm they are numbers" ); 
            WARP_LOCS.RELEASE = { 0, 0, 0 } 
        else  
            WARP_LOCS.RELEASE = { tonumber(warp_release[1]), tonumber(warp_release[2]), tonumber(warp_release[3]) }; 
        end  
    end  
     
    if ( not warp_admin ) then  
        outputDebugString ( "Couldn't find '*JAIL_WARP_ADMIN_LOCATION' setting in SAEGPolice" ); 
        WARP_LOCS.ADMIN = { 0, 0, 0 } 
    else  
        local warp_admin = split ( warp_admin, "," ); 
        if ( #warp_admin ~= 3 ) then  
            outputDebugString ( "'*JAIL_WARP_ADMIN_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); 
            WARP_LOCS.ADMIN = { 0, 0, 0 } 
        elseif ( not tonumber ( warp_admin[1] ) or not tonumber ( warp_admin[2] ) or not tonumber ( warp_admin[3] ) ) then  
            outputDebugString ( "Failed to convert all '*JAIL_WARP_ADMIN_LOCATION' coordinates to floats. Please confirm they are numbers" ); 
            WARP_LOCS.ADMIN = { 0, 0, 0 } 
        else  
            WARP_LOCS.ADMIN = { tonumber(warp_admin[1]), tonumber(warp_admin[2]), tonumber(warp_admin[3]) }; 
        end  
    end  
     
    outputDebugString ( "Default jail warp location: "..tostring ( table.concat( WARP_LOCS.DEFAULT, ", " ) ) ) 
    outputDebugString ( "Admin jail warp location: "..tostring ( table.concat( WARP_LOCS.ADMIN, ", " ) ) ) 
    outputDebugString ( "Release jail warp location: "..tostring ( table.concat( WARP_LOCS.RELEASE, ", " ) ) ) 
  
end ); 
  
local jailedPlayers = { } 
  
function isPlayerJailed ( p ) 
    if ( p and getElementType ( p ) == 'player' ) then 
        if ( jailedPlayers[p] ) then 
            return tonumber ( getElementData ( p, 'SAEGPolice:JailTime' ) ) 
        else 
            return false 
        end 
    end 
    return nil 
end 
  
function jailPlayer ( p, dur, announce, element, reason )  
    if( p and dur ) then 
        local announce = announce or false 
        jailedPlayers[p] = dur 
        setElementInterior ( p, 0 ) 
        setElementDimension ( p, 1 ) 
         
        local __x, __y, __z = unpack ( WARP_LOCS.DEFAULT ) 
        if ( element and reason ) then 
            __x, __y, __z = unpack ( WARP_LOCS.ADMIN ) 
        end  
         
        setElementPosition ( p, __x, __y, __z ); 
        --outputChatBox ( table.concat ( { __x, __y, __z }, ", " ) ); 
         
        setElementData ( p,'SAEGPolice:JailTime', tonumber ( dur ) ) 
        setElementData ( p, "isGodmodeEnabled", true ) 
        exports['SAEGJobs']:updateJobColumn ( getAccountName ( getPlayerAccount ( p ) ), 'TimesArrested', "AddOne" ) 
        if ( announce ) then 
            local reason = reason or "Classified" 
            local msg = "" 
            if ( element and reason ) then 
                msg = getPlayerName ( p ).." has been jailed by "..getPlayerName ( element ).." for "..tostring ( dur ).." seconds ("..reason..")" 
            elseif ( element ) then 
                msg =  getPlayerName ( p ).." has been jailed by "..getPlayerName ( element ).." for "..tostring ( dur ).." seconds" 
            end 
            exports['SAEGMessages']:sendClientMessage ( msg, root, 0, 120, 255 ) 
            exports['SAEGLogs']:outputPunishLog ( p, element or "Console", tostring ( msg ) ) 
        end 
        triggerEvent ( "onPlayerArrested", p, dur, element, reason ) 
        triggerClientEvent ( p, "onPlayerArrested", p, dur, element, reason ) 
        return true 
    end 
    return false 
end 
  
function unjailPlayer ( p, triggerClient ) 
    local p = p or source 
    setElementDimension ( p, 0 ) 
    setElementInterior ( p, 0 ) 
    setElementPosition ( p, 1543.32, -1675.6, 13.56 ) 
    exports['SAEGMessages']:sendClientMessage ( "You've been released from jail! Behave next time.", p, 0, 255, 0 ) 
    jailedPlayers[p] = nil 
    setElementData ( p, "SAEGPolice:JailTime", nil ) 
    setElementData ( p, "isGodmodeEnabled", nil ) 
    exports['SAEGLogs']:outputActionLog ( getPlayerName ( p ).." has been unjailed" ) 
    if ( triggerClient ) then 
        triggerClientEvent ( p, 'SAEGJail:StopJailClientTimer', p )  
    end 
end 
addEvent ( "SAEGJail:UnjailPlayer", true ) 
addEventHandler ( "SAEGJail:UnjailPlayer", root, unjailPlayer ) 
  
function getJailedPlayers ( ) 
    return jailedPlayers 
end 
  
addCommandHandler ( "jail", function ( p, _, p2, time, ... ) 
    if ( exports['SAEGAdministration']:isPlayerStaff ( p ) ) then 
        if ( p2 and time ) then 
            local toJ = getPlayerFromName ( p2 ) or exports['SAEGPlayerFunctions']:getPlayerFromNamePart ( p2 ) 
            if toJ then 
                jailPlayer ( toJ, time, true, p, table.concat ( { ... }, " " ) ) 
            else 
                exports['SAEGMessages']:sendClientMessage ( "No player found with \""..p2.."\" in their name.", p, 255, 0, 0 ) 
            end 
        else 
            exports['SAEGMessages']:sendClientMessage ( "Syntax: /jail [player name/part of name] [seconds] [reason]", p, 255, 255, 0 ) 
        end 
    end 
end ) 
  
addCommandHandler ( "unjail", function ( p, _, p2 )  
    if ( not exports['SAEGAdministration']:isPlayerStaff ( p ) ) then 
        return false 
    end if ( not p2 ) then 
        return exports['SAEGMessages']:sendClientMessage ( "Syntax: /unjail [player]", p, 255, 255, 0 ) 
    end if ( not getPlayerFromName ( p2 ) ) then 
        p2 = exports['SAEGPlayerFunctions']:getPlayerFromNamePart ( p2 ) 
        if not p2 then 
            return exports['SAEGMessages']:sendClientMessage ( "That player doesn't exist on the server.", p, 255, 0, 0 ) 
        end 
    end 
     
    if ( jailedPlayers[p2] ) then 
        exports['SAEGMessages']:sendClientMessage ( "You've unjailed "..getPlayerName ( p2 ).."!", p, 0, 255, 0 ) 
        exports['SAEGMessages']:sendClientMessage ( "You've been unjailed by "..getPlayerName ( p ).."!", p2, 0, 255, 0 ) 
        unjailPlayer ( p2, true ) 
    else 
        exports['SAEGMessages']:sendClientMessage ( "That player isn't jailed.", p, 255, 0, 0 ) 
    end 
     
end ) 
  
  
  
  
  
  
  
addEventHandler ( "onResourceStop", resourceRoot, function ( ) 
    exports['NGSQL']:saveAllData ( false ) 
end )  addEventHandler ( "onResourceStart", resourceRoot, function ( ) 
    setTimer ( function ( ) 
        local q = exports['NGSQL']:db_query ( "SELECT * FROM accountdata" ) 
        local data = { } 
        for i, v in ipairs ( q ) do 
            data[v['Username']] = v['JailTime'] 
        end 
         
         
        for i, v in pairs ( data ) do  
            local p = exports['SAEGPlayerFunctions']:getPlayerFromAcocunt ( i ) 
            if p then 
                local t = tonumber ( getElementData ( p, 'SAEGPolice:JailTime' ) ) or i 
                jailPlayer ( p, tonumber ( t ), false ) 
            end 
        end 
    end, 500, 1 ) 
end ) 
addEvent ( "onPlayerArrested", true ) 
  

local remainingTime = nil 
local sx, sy = guiGetScreenSize ( ) 
  
addEvent ( "onPlayerArrested", true ) 
addEventHandler ( "onPlayerArrested", root, function ( dur ) 
    if dur then 
        remainingTime = dur 
        l_tick = getTickCount ( ) 
        addEventHandler ( 'onClientRender', root, dxDrawRemainingJailTime ) 
    end 
end ) 
  
function dxDrawRemainingJailTime ( ) 
    dxDrawText ( tostring ( remainingTime ).. " seconds", 0, 0, (sx/1.1)+2, (sy/1.1)+2, tocolor ( 0, 0, 0, 255 ), 2.5, 'default-bold', 'right', 'bottom' ) 
    dxDrawText ( tostring ( remainingTime ).. " seconds", 0, 0, sx/1.1, sy/1.1, tocolor ( 255, 255, 0, 255 ), 2.5, 'default-bold', 'right', 'bottom' ) 
    if ( getTickCount ( ) - l_tick >= 1000 ) then 
        remainingTime = remainingTime - 1 
        l_tick = getTickCount ( ) 
        setElementData ( localPlayer, "SAEGPolice:JailTime", remainingTime )  
        if ( remainingTime < 0 ) then 
            triggerServerEvent ( "SAEGJail:UnjailPlayer", localPlayer, false ) 
            remainingTime = nil 
            l_tick = nil 
            removeEventHandler ( "onClientRender", root, dxDrawRemainingJailTime ) 
        end 
    end 
end 
  
addEvent ( "SAEGJail:StopJailClientTimer", true ) 
addEventHandler ( "SAEGJail:StopJailClientTimer", root, function ( ) 
    remainingTime = nil 
    l_tick = nil 
    removeEventHandler ( "onClientRender", root, dxDrawRemainingJailTime ) 
end ) 
  
  
------------------------------- 
-- Export functions  
-- Implemented in NG V1.1.3 
------------------------------- 
function isPlayerJailed ( ) 
    return (  
        getElementData ( localPlayer, 'SAEGPolice:JailTime' ) and  
        tonumber ( getElementData ( localPlayer, 'SAEGPolice:JailTime' ) )  
        ) and  
        tonumber ( getElementData ( localPlayer, 'SAEGPolice:JailTime' ) ) > 0 
end 

    "SAEG Scripting Team" type="script" name="SAEG Police" version="1.0" /> 
    

Link to comment
I Have Nerd Gaming GameMode

And you're not from the community, these files haven't been released by them so this'll be another leaked resource. We're not supporting leaked files and therefore you won't receive any help either. Learn Lua yourself, hire a scripter or what ever. Stop using leaked files.

Link to comment
I Have Nerd Gaming GameMode

And you're not from the community, these files haven't been released by them so this'll be another leaked resource. We're not supporting leaked files and therefore you won't receive any help either. Learn Lua yourself, hire a scripter or what ever. Stop using leaked files.

lol it's not Laeked -.-

hhhh

Guys pls help me :/ pls

Link to comment

it's when player arrest cop he need go to LS marker for the player warpet to jail and when release he's Released Only in LS too

i want it : when cop arrest player the marker showed in the pos LS ,LV,SF ...ect and if the cop go to marker of LV then if player arrested in LV he released in LV if arrested in SF then Released In SF i hope u understand me (the pos what i did)

Link to comment

The biggest problem with people like you (no offense) is that you are too focussed on trying to achieve the scripts you need for your own server. This is something I had too and lots of other people probably too. The fact is, you should try learning lua not MTA. Not even lua is suggested, C# is good as well, if only you can understand HOW programming works, you can learn any language.

Link to comment
The biggest problem with people like you (no offense) is that you are too focussed on trying to achieve the scripts you need for your own server. This is something I had too and lots of other people probably too. The fact is, you should try learning lua not MTA. Not even lua is suggested, C# is good as well, if only you can understand HOW programming works, you can learn any language.

Good point, I hope he start make some efforts.

Link to comment

First of all you need to understand the code, then you can describe your problem and finally solve it. Three basic steps which I should now try to help you with. As a start you should ask yourself from where you can get the current coordinate(s), hint: in the server side files you'll find a function simply named "get" which collects the coordinates from meta.xml, between the tags. Now here's your real problem, without even looking at the NG game mode it's obvious that you first of all need to change how you store the coordinates in order to map multiple coordinates to each others.

So here's the steps you need to take in order to solve this:

  • Consider a different storage solution for your coordinates that supports multiple locations, (i.e a table)
  • Add some kind of index to these tables (i.e "LSPD" and/or "SFPD"). This way you know where a player got arrested and thus where to release.
  • Consider where to store this index, (i.e as element data)
  • Consider which coordinates you intend to use, if you want someone to do this for you this is a post you should provide yourself at least.

And that's pretty much it, the solution is simple as long you know the problem.

Link to comment
Guys we are asking for help not for useless comments so please just help us if you can...

Really? Do you think all these comments are useless, So that's mean you don't cares when most of them spend their time to write a paragraph to show you how to be a guy capable not a guy waiting for a done codes like what you guys do now.

Personally, I agree with ViRuZGamiing's words.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...