I have a question.
Will this announce when a player leaves the server?
function my_callback(%client) {
centerprintall("Character ID " @ %client.player.getCharacterId() @ " has left the world!", 8);
}
TTmod_registerPlayerLeaveCallback("my_callback");
And if its correct can I save it and the script to announce when a player joins to the same file and have it still work properly?
I know nothingnothingnothing about scripts.
Thanks
Re: Help with a simple Script for Server
2Yes, though you will need to have different names for the functions.
Re: Help with a simple Script for Server
3Okay
As Im am unsure if Ive done this correctly Im putting it here for you to see. Also Ive noticed there is a folder in the main folder the is called lif_scripts. Is this were I should/can house custom scripts? Lastly as far as naming the script goes. I would just save it as activity.cs and then point to it in the main.cs file?
function player_logout(%client) {
centerprintall("Character ID " @ %client.player.getCharacterId() @ " has left the world!", 8);
}
TTmod_registerPlayerLeaveCallback("player_logout");
Thank You
Cia
As Im am unsure if Ive done this correctly Im putting it here for you to see. Also Ive noticed there is a folder in the main folder the is called lif_scripts. Is this were I should/can house custom scripts? Lastly as far as naming the script goes. I would just save it as activity.cs and then point to it in the main.cs file?
function player_logout(%client) {
centerprintall("Character ID " @ %client.player.getCharacterId() @ " has left the world!", 8);
}
TTmod_registerPlayerLeaveCallback("player_logout");
Thank You
Cia
Re: Help with a simple Script for Server
4That is correct.
You can put custom scripts wherever you like within the folder structure. Just need to point to the correct path and file in main.cs
Just try these things out. No need to be overly careful. In worst case your script won't load.
You can put custom scripts wherever you like within the folder structure. Just need to point to the correct path and file in main.cs
Just try these things out. No need to be overly careful. In worst case your script won't load.
Re: Help with a simple Script for Server
5I continue in this thread since it seems the most appropriate to follow my question ...
I'm not very knowledgeable about this programming language, that's why I need a little help,
I put the script on my next server ...
Effectively works perfect, my question is how I would have to put it, so that this message would appear in the tabs of System and at the same time in Local ?.
I did tests but the truth is, I think I'm quite clumsy.
Thank you.
I'm not very knowledgeable about this programming language, that's why I need a little help,
I put the script on my next server ...
Code: Select all
function my_callback (% client) {
centerprintall ("Character ID" @% client.player.getCharacterId () @ "you entered the world!", 8);
}
TTmod_registerPlayerEnterCallback ("my_callback");
I did tests but the truth is, I think I'm quite clumsy.
Thank you.
Re: Help with a simple Script for Server
6That would be:
Code: Select all
// Send message to local chat:
cmChatSendLocalMessageToClient( %client, "Server", %client.player.getPosition(), " " @ "Your message..." );
// Send system chat message:
%client.cmSendClientMessage( 2475, "Your message..." );
Re: Help with a simple Script for Server
7Thank you very much, then I understand that it could be like that, is it correct? ...
Code: Select all
function my_callback (% client) {
cmChatSendLocalMessageToClient( %client, "Server", %client.player.getPosition(), " " @ "Your message..." );
%client.cmSendClientMessage( 2475, "Your message..." );
}
TTmod_registerPlayerEnterCallback ("my_callback");
Re: Help with a simple Script for Server
10Well, I put it the same as before, and nothing comes out, something I think I did wrong, I pass the files in case I have something wrong.
I'm sorry to be so clumsy. Thanks
I'm sorry to be so clumsy. Thanks