+ Reply to Thread
Results 1 to 8 of 8

Thread: E:setpos(V) and E:chatPrint(N) restrict, need help.

  1. #1
    Wire Noob sadow200's Avatar
    Join Date
    Jun 2007
    Posts
    11

    Default E:setpos(V) and E:chatPrint(N) restrict, need help.

    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
    ________________________________________________

    Ryu FTW

  2. #2
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    Heh you're using my old E2 extension.
    To fix your problem, use "self.player" instead of "ply". You're getting the error because "ply" doesn't exist.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  3. #3
    Wire Noob sadow200's Avatar
    Join Date
    Jun 2007
    Posts
    11

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    o haha thanks XD is there a way to use it like a group so it would be easy to add more people to use it?
    ________________________________________________

    Ryu FTW

  4. #4
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    Weren't you going to make it check with ULX ranks? If so, you should already have groups.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  5. #5
    Wire Noob sadow200's Avatar
    Join Date
    Jun 2007
    Posts
    11

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    yes but when i tryed to do that it dident work could u give me an example of how to do it if u dont mind
    ________________________________________________

    Ryu FTW

  6. #6
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    I don't know how ULX manages ranks, sorry
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  7. #7
    Wire Noob sadow200's Avatar
    Join Date
    Jun 2007
    Posts
    11

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    haha same thanks for the help you gave and u make great stuff realy like ur pack XD
    ________________________________________________

    Ryu FTW

  8. #8
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: E:setpos(V) and E:chatPrint(N) restrict, need help.

    Quote Originally Posted by sadow200 View Post
    realy like ur pack XD
    Those E2 extensions are a piece of crap. Made it back when I sucked at Lua.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots