PM script

Have a question you need to ask? Need help? Ask here!

Moderator: Core Staff

Post Reply
User avatar
mik3yb
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 4th, 2010, 1:18 am
Location: Ontario

PM script

Post by mik3yb » October 4th, 2010, 1:43 am

I was wondering if anyone could help me with this PM script i have been trying to make it is giving me a lot of trouble and i was wondering if anyone could help, the idea is the client enters the players name in a dvar "cj_pm_name" and then enter the pm in "cj_pm" and upon doing so the data will be sent through the server and then be checked on all clients to see if their name matches the one given by the client and if it matches then the message is printed. But it doesn't seem to work...
The dvars do not even show up clientside so i'm really lost at what went wrong.

I'm open to any suggestions.

Code: Select all

getinfo()
{
    if(getDvar("cj_pm") == "")
    {
        setDvar("cj_pm","none");
    }

    if(getDvar("cj_pm_name") == "")
    {
        setDvar("cj_pm_name","none");
    }
        
    if((getDvar("cj_pm_name") != "none") && (getDvar("cj_pm") != "none"))
    {
        cjname = getDvar("cj_pm_name");
        cjPM = getDvar("cj_pm");
        thread PMtransfer(cjname,cjPM);
        wait 2;
        setDvar("cj_pm","none");
    }
            
}

PMtransfer(client,message)
{
    self thread sendmessage(client,message);        
}

sendmessage(client_name,PM)
{
    if(self.name == client_name)
    {
        self iPrintlnBold(PM);
    }    
}

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: PM script

Post by megazor » October 4th, 2010, 9:27 am

you have made a few mistakes in the script, but the major problem is that you cant learn client dvars with modding. and a client can change server ones only with rcon. in cod 1, there is a command 'tell', which is used exactly for sending PMs.

User avatar
mik3yb
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 4th, 2010, 1:18 am
Location: Ontario

Re: PM script

Post by mik3yb » October 4th, 2010, 12:30 pm

I don't think a command called tell exists in cod 4
according to :http://www.zeroy.com/script/

and what do you mean by you can't learn client dvars from modding? What i want to do is implement the Dvars so that every client can change theirs and when they set a PM it gets autosent to the cj_pm_name they selected. If it's importatnt i call getinfo() as a player thread in _codjumper.gsc
Image

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: PM script

Post by megazor » October 4th, 2010, 1:03 pm

those are script functions, not client commands. but 'tell' doesnt exist anyway.


i think you cant change server dvars to random string.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: PM script

Post by Drofder2004 » October 4th, 2010, 1:29 pm

I had an idea for PM's to be added in CJ but never got round to doing it.

The idea is simple:
Create a menu:

2 boxes:
Player
Message

Enter button.
---

Similar to the vote menu in CJ, but instead of storing a number (yes or no vote), it will store a message and a player.
Create a menuresponse to decode the variables and then print the message on the players screen (or use a hud to display it).

But, you cannot use DVARs.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
mik3yb
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 4th, 2010, 1:18 am
Location: Ontario

Re: PM script

Post by mik3yb » October 4th, 2010, 9:08 pm

I have never actually tried to create a menu i have been fairly limited to just writing this stuff in a text editor. to create a menu do you need the mod tools? sorry if that sounds kinda dumb xD
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: PM script

Post by Drofder2004 » October 4th, 2010, 10:07 pm

You need the mod tools for everything...

Compiler and RAW files being the main.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
mik3yb
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 4th, 2010, 1:18 am
Location: Ontario

Re: PM script

Post by mik3yb » October 4th, 2010, 11:12 pm

alright i have the mod tools now how do i go about making the .menu or whatever it is i need ? :D
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest