Szerző Téma: Telefon rendszer  (Megtekintve 594 alkalommal)

Telefon rendszer
« Dátum: 2017. Április 21. - 19:43:59 »
0
Sziasztok
 
Egy olyan problémám lenne hogy ha egy személyt felhívok akkor a /p parancs segítségével át kéne küldenie az üzenetet de ez nem történik meg.
 
Mi lehet a probléma??ű
 
 
 
 
 
function talkPhone(thePlayer, commandName, ...)
    local logged = getElementData(thePlayer, \"loggedin\")
    
    if (logged==1) then
        if (exports.global:hasItem(thePlayer, 2)) or getElementData(thePlayer, \"call.col\") then -- 71 = Cell phone item
            if not (...) then
                outputChatBox(\"#ffffff[#cb0033Ariston #ffffff- #FFA700Használat#ffffff]: /p [Üzenet]\", thePlayer, 255, 0, 0,true)
            elseif getElementData(thePlayer, \"injuriedanimation\") then
                outputChatBox(\"#cb0033[Telefon] #ffffffNem használhattod a telefonod, míg eszméletlen vagy.\", thePlayer, 255, 0, 0,true)
            else
                local phoneState = getElementData(thePlayer, \"phonestate\")
                
                if (phoneState>=1) then -- The player is in a call, not just dialing (2= loudspeaker)
                    local message = table.concat({...}, \" \")
                    local username = getPlayerName(thePlayer):gsub(\"_\", \" \")
                    local phoneNumber = getElementData( thePlayer, \"call.col\" ) and \"?\" or getElementData(thePlayer, \"cellnumber\")
                    
                    local languageslot = getElementData(thePlayer, \"languages.current\")
                    local language = getElementData(thePlayer, \"languages.lang\" .. languageslot)
                    local languagename = call(getResourceFromName(\"language-system\"), \"getLanguageName\", language)
                    
                    local target = getElementData(thePlayer, \"calling\")
                    
                    local callprogress = getElementData(thePlayer, \"callprogress\")
                    if (callprogress) then
                        outputChatBox(\"Te [TELEFON]: \" ..message, thePlayer)
                        -- Send it to nearby players of the speaker
                        exports.global:sendLocalText(thePlayer, username .. \" [TELEFON]: \" .. message, nil, nil, nil, 10, {[thePlayer] = true})
                        
                        if (tonumber(target)==7979) then -- EMERGENCY SERVICES
                            if (callprogress==1) then -- Requesting the location
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\", message)
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\", 2)
                                outputChatBox(\"7979 Diszpécser mondja: Kérem mesélje el a pontos történetet!\", thePlayer)
                                return
                            elseif (callprogress==2) then -- Requesting the situation
                                outputChatBox(\"7979 Diszpécser mondja: Köszönjük a hívását! Az egység(ek) már uton vannak.\", thePlayer)
                                
                                local location = getElementData(thePlayer, \"call.location\")
 
                                exports.global:SendMessageToTeam(\"Országos Rendőr Főkapitányság\",\"[HÍVÁS] Egy segélykérés érkezett!\", 215, 86, 86)
                                exports.global:SendMessageToTeam(\"Országos Rendőr Főkapitányság\",\"[HÍVÁS] Ok: \'\" .. message .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 215, 86, 86)
                                exports.global:SendMessageToTeam(\"Országos Rendőr Főkapitányság\",\"[HÍVÁS] Pozíció: \'\" .. tostring(location) .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 215, 86, 86)
                                exports.global:SendMessageToTeam(\"Honvédség\",\"[Rádió] Itt a diszpécser központ! Erősítést kértek! Vége.\", 0, 183, 239)
                                exports.global:SendMessageToTeam(\"Honvédség\",\"[Rádió] Indok: \'\" .. message .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 0, 183, 239)
                                exports.global:SendMessageToTeam(\"Honvédség\",\"[Rádió] ELhelyezkedés: \'\" .. tostring(location) .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 0, 183, 239)
                                
                                
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"calling\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"caller\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"phonestate\", 0, false)
                                exports.global:sendLocalMeAction(thePlayer, \"leteszi a telefont.\")
                                
                                exports.global:applyAnimation(thePlayer, \"ped\", \"phone_out\", 1000, false, true, true)
                                toggleAllControls(thePlayer, true, true, true)
                                return
                            end
                        elseif (tonumber(target)==6969) then -- Mentők
                            if (callprogress==1) then -- Requesting the location
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\", message)
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\", 2)
                                outputChatBox(\"6969 Diszpécser mondja: Kérem mesélje el a pontos történetet!\", thePlayer)
                                return
                            elseif (callprogress==2) then -- Requesting the situation
                                outputChatBox(\"6969 Diszpécser mondja: Köszönjük a hívását! Rohammentőseink úton vannak ön felé.\", thePlayer)
                                
                                local location = getElementData(thePlayer, \"call.location\")
 
                                exports.global:SendMessageToTeam(\"Országos Mentőszolgálat\",\"[HÍVÁS] Egy sűrgős hívás érkezett!\", 215, 86, 86,true)
                                exports.global:SendMessageToTeam(\"Országos Mentőszolgálat\",\"[HÍVÁS] Oka: \'\" .. message .. \"\', ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 215, 86, 86,true)
                                exports.global:SendMessageToTeam(\"Országos Mentőszolgálat\",\"[HÍVÁS] Pozíció: \'\" .. tostring(location) .. \"\', ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", 215, 86, 86,true)
                                
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"calling\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"caller\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"phonestate\", 0, false)
                                exports.global:sendLocalMeAction(thePlayer, \"leteszi a telefont.\")
                                
                                exports.global:applyAnimation(thePlayer, \"ped\", \"phone_out\", 1000, false, true, true)
                                toggleAllControls(thePlayer, true, true, true)
                                return
                            end
                        elseif (tonumber(target)==311) then -- EMERGENCY SERVICES
                            if (callprogress==1) then -- Requesting the location
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\", message)
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\", 2)
                                outputChatBox(\"LSPD Diszpécser mondja: Eltudná mondani a történteket?\", thePlayer)
                                return
                            elseif (callprogress==2) then -- Requesting the situation
                                outputChatBox(\"LSPD Diszpécser mondja: Köszönjük a hívását. Már uton vannak az egységek.\", thePlayer)
                                
                                local location = getElementData(thePlayer, \"call.location\")
                                local theTeam = getTeamFromName(\"Országos Rendőr Fő-kapitányság\")
                                local teamMembers = getPlayersInTeam(theTeam)
                                
                                
                                for key, value in ipairs(teamMembers) do
                                    outputChatBox(\"[RÁDIÓ] Itt a diszpécser központ, egy hívás érkezett a rendõrségi vonalra, vége.\", value, 245, 40, 135)
                                    outputChatBox(\"[RÁDIÓ] Hívás oka: \'\" .. message .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", value, 245, 40, 135)
                                    outputChatBox(\"[RÁDIÓ] Helyzette: \'\" .. tostring(location) .. \"\', vége. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", value, 245, 40, 135)
                                end
                                
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"calling\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"caller\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"phonestate\", 0, false)
                                exports.global:sendLocalMeAction(thePlayer, \"leteszi a telefonját.\")
                                
                                exports.global:applyAnimation(thePlayer, \"ped\", \"phone_out\", 1000, false, true, true)
                                toggleAllControls(thePlayer, true, true, true)
                                return
                            end
                        elseif (tonumber(target)==999) then -- TOWING
                            if (callprogress==1) then -- Requesting the location
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\", message)
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\", 2)
                                outputChatBox(\"LST&R Operator says: Can you describe the situation please?\", thePlayer)
                                return
                            elseif (callprogress==2) then -- Requesting the situation
                                outputChatBox(\"LST&R Operator says: Thanks for your call, we\'ve dispatched a unit to your location.\", thePlayer)
                                
                                local location = getElementData(thePlayer, \"call.location\")
                                local theTeam = getTeamFromName(\"Los Santos Towing and Recovery\")
                                local teamMembers = getPlayersInTeam(theTeam)
                                
                                for key, value in ipairs(teamMembers) do
                                    outputChatBox(\"[RADIO] This is dispatch, We\'ve got an incident, Over.\", value, 0, 183, 239)
                                    outputChatBox(\"[RADIO] Situation: \'\" .. message .. \"\', Over. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", value, 0, 183, 239)
                                    outputChatBox(\"[RADIO] Location: \'\" .. tostring(location) .. \"\', Over. ((\" .. getPlayerName(thePlayer):gsub(\"_\",\" \") .. \"))\", value, 0, 183, 239)
                                end
                                
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"calling\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"caller\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"phonestate\", 0, false)
                                exports.global:sendLocalMeAction(thePlayer, \"hangs up their cellphone.\")
                                
                                exports.global:applyAnimation(thePlayer, \"ped\", \"phone_out\", 1000, false, true, true)
                                toggleAllControls(thePlayer, true, true, true)
                                return
                            end
                        elseif (tonumber(target)==8294) then -- TAXI
                            if (callprogress==1) then
                                local founddriver = false
                                
                                for key, value in ipairs(exports.pool:getPoolElementsByType(\"player\")) do
                                    local job = getElementData(value, \"job\")
                                    
                                    if (job == 2) then
                                        local car = getPedOccupiedVehicle(value)
                                        if car and (getElementModel(car)==438 or getElementModel(car)==420) then
                                            outputChatBox(\"[HÍVÁS] \" .. getPlayerName(thePlayer):gsub(\"_\",\" \") ..\" Tel.:\" .. phoneNumber .. \" Helyzette: \" .. message ..\".\" , value, 0, 183, 239)
                                            founddriver = true
                                        end
                                    end
                                end
                                
                                if founddriver == true then
                                    outputChatBox(\"Taxi Diszpécser mondja: Köszönjük a hívását. A taxi hamarossan megérkezzik!\", thePlayer)
                                else
                                    outputChatBox(\"Taxi Diszpécser mondja: Nincs szabad taxi a közelében. Kérjük próbálja késõbb.\", thePlayer)
                                end
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"calling\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"caller\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"callprogress\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"call.location\")
                                exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"phonestate\", 0, false)
                                exports.global:sendLocalMeAction(thePlayer, \"lerakja a telefonját.\")
                                
                                exports.global:applyAnimation(thePlayer, \"ped\", \"phone_out\", 1000, false, true, true)
                                toggleAllControls(thePlayer, true, true, true)
                                return
                            end
                        end
                    end
                    
                    message = call( getResourceFromName( \"am_chat\" ), \"trunklateText\", thePlayer, message )
                    local message2 = call(getResourceFromName(\"language-system\"), \"applyLanguage\", thePlayer, target, call( getResourceFromName( \"wls_chat\" ), \"trunklateText\", target, message ), language)
                    local idje = tonumber(getElementData(thePlayer, \"playerid\"))
                    outputChatBox(\"#cb0033\" .. username .. \" #53bfdc(\"..idje..\") #D75656[Telefon]: #ffffff\" .. message2, target,255, 0, 0,true)
                    
                    -- Send the message to the person on the other end of the line
                    outputChatBox(\"#cb0033Te #53bfdc(\"..idje..\") #D75656[Telefon]: #ffffff\" ..message, thePlayer,255, 0, 0,true)
                    
                    -- Send it to nearby players of the speaker
                    exports.global:sendLocalText(thePlayer, username .. \" [TELEFON]: \" .. message, nil, nil, nil, 10, {[thePlayer] = true})
                    
                    local phoneState = getElementData(target, \"phonestate\")
                    -- Send it to the listener, if they have loud speaker
                    if (phoneState==2) then -- Loudspeaker
                        local x, y, z = getElementPosition(target)
                        local username = getPlayerName(target):gsub(\"_\", \" \")
                        
                        for index, nearbyPlayer in ipairs(getElementsByType(\"player\")) do
                            if isElement(nearbyPlayer) and nearbyPlayer ~= target and getDistanceBetweenPoints3D(x, y, z, getElementPosition(nearbyPlayer)) < 40 and getElementDimension(nearbyPlayer) == getElementDimension(target) then
                                local message2 = call(getResourceFromName(\"language-system\"), \"applyLanguage\", thePlayer, nearbyPlayer, call( getResourceFromName( \"wls_chat\" ), \"trunklateText\", target, message ), language)
                                outputChatBox(\"[\" .. languagename .. \"] \" .. username .. \"telefonjának kihangosítója: \" .. message2, nearbyPlayer)
                            end
                        end
                    end
                else
                    outputChatBox(\"#cb0033[Telefon] #ffffffNem vagy hívásban.\", thePlayer, 255, 0, 0,true)
                end
            end
        else
            outputChatBox(\"#cb0033[Telefon] #ffffffHiszed vagy sem, de még senkinek sem sikerült telefon nélkül telefonálnia.\", thePlayer, 255, 0, 0,true)
        end
    end
end
addCommandHandler(\"p\", talkPhone)

Telefon rendszer
« Válasz #1 Dátum: 2017. Május 10. - 10:32:46 »
+2
Kicsit unalmas már idáig a posztok nagy része összesen annyiból áll hogy kirakják a scriptet és te meg olvasd át az egészet és gyere rá a hibájukra .. Debugscript nélkül nem tudunk segíteni de ahogy így rá nézek több hiba /hiányosság is akad benne
 
 

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal