Hello Could you help me please.
I have tried to make the functions for admin and specific players by SteamId or by ULX groups but every time the player I tried to add got this error
sv: Expression 2 (Test Teleport): ...gmod_wire_expression2\core\custom\divranse2stuf f.lua:293: attempt to index global 'ply' (a nil value)
Here Are The Codes:
Code:
//PRINT TO CHAT VERSION 1
registerFunction("chatPrint", "ns", "", function(self,args)
local op1, op2 = args[2], args[3]
local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
if (!self.player:IsAdmin() and self.player != ULib.getUser( daranable,
enable_keywords,
ply )) then return end
local Msg = rv2
local Number = rv1
if (Number == 0) then
Msg = Msg
elseif (Number == 1) then
Msg = "[E2] "..Msg
elseif (Number == 2) then
Msg = "[".. self.player:GetName() .."'s E2] ".. Msg
else
self.player:PrintMessage( HUD_PRINTTALK, "You can only use 0, 1 or 2. This message tells you that you entered the wrong number. This cannot be seen by others." )
return
end
for k,v in pairs ( player.GetAll() ) do
v:PrintMessage( HUD_PRINTTALK, Msg );
end
end)
//PRINT TO CHAT VERSION 1 END
//PRINT TO CHAT VERSION 2
registerFunction("chatPrint", "s", "", function(self,args)
local op1 = args[2]
local rv1 = op1[1](self,op1)
if (!self.player:IsAdmin() and ply.steamID()!="STEAM_0:1:148*****") then return end
local Msg = rv1
for k,v in pairs ( player.GetAll() ) do
v:PrintMessage( HUD_PRINTTALK, Msg );
end
end)
//PRINT TO CHAT VERSION 2 END
//PRINT TO CHAT VERSION 3
registerFunction("chatPrint", "e:s", "", function(self,args)
local op1, op2 = args[2], args[3]
local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
if (!self.player:IsAdmin() and ply.steamID()!="STEAM_0:1:148*****") then return end
if (!validEntity(rv1)) then return end
rv1:PrintMessage( HUD_PRINTTALK, rv2 );
end)
//PRINT TO CHAT VERSION 3 END
//PRINT TO CHAT VERSION 4
registerFunction("chatPrint", "e:ns", "", function(self,args)
local op1, op2, op3 = args[2], args[3], args[4]
local rv1, rv2, rv3 = op1[1](self,op1), op2[1](self,op2), op3[1](self,op3)
if (!self.player:IsAdmin() and ply.steamID()!="STEAM_0:1:148*****") then return end
if (!validEntity(rv1)) then return end
local Number = rv2
local Msg = rv3
if (Number == 0) then
Msg = Msg
elseif (Number == 1) then
Msg = "[E2] "..Msg
elseif (Number == 2) then
Msg = "[".. self.player:GetName() .."'s E2] ".. Msg
else
self.player:PrintMessage( HUD_PRINTTALK, "You can only use 0, 1 or 2. This message tells you that you entered the wrong number. This message cannot be seen by others." )
return
end
rv1:PrintMessage( HUD_PRINTTALK, Msg );
end)
//PRINT TO CHAT VERSION 4 END Code:
//Teleport
registerFunction("setPos", "e:v", "", function(self,args)
local op1, op2 = args[2], args[3]
local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
local Pos = Vector( rv2[1], rv2[2], rv2[3] )
if (!validEntity(rv1)) then return end
if (!self.player:IsAdmin()) then
if (rv1:IsPlayer() and ply.steamID()!="STEAM_0:1:148*****" or !isOwner(self,rv1)) then return end
end
if (!util.IsInWorld(Pos)) then return end
rv1:SetPos( Pos )
end)
//Teleport
Bookmarks