Police report ! Comment ajoute d'autre metiers

  • Initiateur de la discussion
D

Dawaklawak

Geek
Messages
261
Score réaction
22
Points
95
Bonjour !
Voilas j'ai un script qui permet que lorsque que l'on fait /911 text cela appel la police sauf que moi j'aimerais que sa le fasse aussi au gign par exemple mais je ne trouve pas pourriez vous m'indiquer svp ?

net.Receive( "PA", function( len )
name_read = net.ReadString()
model_read = net.ReadString()
report_read = net.ReadString()
end )

SoundsRadio = {
"npc/overwatch/radiovoice/off4.wav",
"npc/overwatch/radiovoice/off2.wav",
"npc/overwatch/radiovoice/on1.wav",
"npc/overwatch/radiovoice/on3.wav"
}



function PoliceAlert( )
math.randomseed(os.time())
surface.PlaySound(SoundsRadio[math.random(1,4)])
local dP = vgui.Create( "DFrame" )
dP:SetPos( (4/5)*ScrW(),ScrH()/8 )
dP:SetSize( 300, 135 )
timer.Create( "TimerN",10, 1, function() dP:Close() end )
dP:SetTitle( "Police Report" )
dP:SetVisible( true )
dP:SetDraggable( false )
dP:ShowCloseButton( false )
dP:SetKeyboardInputEnabled(false)
dP:SetMouseInputEnabled(true)
dP:SetVisible(true)
dP.Paint = function()
surface.SetDrawColor(0,0,0,150)
dP:DrawFilledRect()
surface.SetDrawColor(0,0,0)
dP:DrawOutlinedRect()
end

local mdlImg = vgui.Create( "SpawnIcon", dP )
mdlImg:SetPos( 5, 30 )
mdlImg:SetModel(model_read)

local title = vgui.Create( "DLabel",dP )
title:SetPos(65, 30)
title:SetText(name_read.." reports:")
title:SetFont("Trebuchet24")
title:SetSize(200,50)
title:SetColor(Color(236, 240, 241))

local subtitle = vgui.Create( "DLabel",dP )
subtitle:SetPos(62, 55)
subtitle:SetText(report_read)
subtitle:SetFont("Trebuchet18")
subtitle:SetColor(Color(236, 240, 241))
subtitle:SetSize(250,50)

local ask = vgui.Create( "DLabel",dP )
ask:SetPos(25, 85)
ask:SetText("Respond?")
ask:SetColor(Color(236, 240, 241))
ask:SetFont("Trebuchet24")
ask:SetSize(250,50)

local yes = vgui.Create( "DButton",dP )
yes:SetPos(135, 100)
yes:SetText(" Yes")
yes:SetSize(60,20)
yes:SetImage("icon16/accept.png")
yes.Paint = function()
draw.RoundedBox( 8, 0, 0, yes:GetWide(), yes:GetTall(), Color( 236, 240, 241, 230 ) )
end
yes.DoClick = function()
timer.Destroy("TimerN")
RunConsoleCommand( "say", "/g Je répond a la demande de "..name_read.."qui nous a appelé." )
RunConsoleCommand( "say", "/pm ".. name_read.." This is the police, we're on the way." )
surface.PlaySound("ambient/levels/prison/radio_random1.wav")
dP:Close()
end

local no = vgui.Create( "DButton",dP )
no:SetPos(210, 100)
no:SetText(" No")
no:SetSize(60,20)
no:SetImage("icon16/delete.png")
no.DoClick = function() dP:Close() timer.Destroy("TimerN") end
no.Paint = function()
draw.RoundedBox( 8, 0, 0, yes:GetWide(), yes:GetTall(), Color( 236, 240, 241, 230 ) )
end

end
usermessage.Hook( "PoliceAlert", PoliceAlert )

util.AddNetworkString("PA")

VERSION = 1.78
EXPIRATION_TIMER = 75 -- In seconds, how long untill the marking disappears?

function chatCommand( ply, text, public )
if (string.sub(text, 1, 4) == "/911") then
if ply:isCP() or ply:isArrested() then return "" end
if ply:GetNWBool("Filter") then DarkRP.notify( ply, 0, 3, "Wait a few seconds before calling the police again." ) return "" end
print(tostring(string.len(string.sub(text, 5, string.len(text)))))
if string.len(string.sub(text, 5, string.len(text))) < 30 and string.len(string.sub(text, 5, string.len(text))) > 1 then
net.Start("PA")
net.WriteString( ply:Nick() )
net.WriteString( ply:GetModel() )
net.WriteString( string.sub(text, 6, string.len(text)) )
ply:SetNWBool("Filter",true) -- antispam
timer.Create("T"..ply:SteamID64(),15,1,function() ply:SetNWBool("Filter",false) end)
net.Broadcast()
for k, v in pairs( player.GetAll() ) do
if ( v:isCP() ) then
umsg.Start( "PoliceAlert", v )
umsg.End( )
end
end
DarkRP.notify( ply, 0, 3, "Envoyé a toutes la police" )
ply:SetNWBool("Called911",true)
timer.Create("ID_"..ply:SteamID64(),EXPIRATION_TIMER,1,function() ply:SetNWBool("Called911",false) end)
return ""
else
DarkRP.notify( ply, 0, 3, "Tu dois faire un texte plus de 5 character et moins 30 character" )
return ""
end
end
end
hook.Add( "PlayerSay", "chatCommand", chatCommand );
 
  • Initiateur de la discussion
D

Dawaklawak

Geek
Messages
261
Score réaction
22
Points
95
up
 
  • Initiateur de la discussion
D

Dawaklawak

Geek
Messages
261
Score réaction
22
Points
95
C'es tout ce que j'ai dessu !
 
Discord d'entraide
Rejoignz-nous sur Discord