Blockland Forums > Modification Help

messageclient(); does not work?

Pages: << < (2/6) > >>

deathrider:


--- Quote from: Lugnut1206 on April 07, 2012, 01:42:55 PM ---
--- Code: ---function servercmdmessage(%client, %user, %message)
{
%name = findclientbyname(%user);
  if(isobject(%name))
    {
        messageclient(%name,'',"Message from :" @ %client.name @ ": message: " @ %message);
    }
    else
    {
        messageclient(%client,'',"The username " @ %user @ " does not exist!");
    }
}
--- End code ---

--- End quote ---
ok i se what i did wrong i was trying to see if a word exists not the player so every single time it would go tell me that my word does not exist

Nexus:


--- Quote from: deathrider on April 07, 2012, 07:13:49 PM ---ok i se what i did wrong i was trying to see if a word exists not the player so every single time it would go tell me that my word does not exist

--- End quote ---

Exactly.  A good way to make sure you don't make that mistake again is by having %user = findclientbyname(%user); at the beginning of the function so you know that it is going to be an object and don't have an extra variable floating around just to confuse you

deathrider:


--- Quote from: Nexus on April 07, 2012, 07:49:06 PM ---Exactly.  A good way to make sure you don't make that mistake again is by having %user = findclientbyname(%user); at the beginning of the function so you know that it is going to be an object and don't have an extra variable floating around just to confuse you

--- End quote ---
ok, now i just look at other scripts on how they add colors to their text

deathrider:

how do i get this to only do it once when you spawn in the server not every time you spawn

--- Code: ---function gameConnection::spawnplayer(%client)
{
  messageClient(%client, '', '\c6This server is running the Personal Message mod \c6use \c3/message USER MESSAGE \c6to send them a personal message.');
}
--- End code ---


Ipquarx:

Use gameConnection::onClientEnterGame.
But parent it, and package it.

Pages: << < (2/6) > >>

Go to full version