View Full Version : Small help, please! +rep

29/04/2015, 02:59 PM
Hello everybody!
I want to ask you - is it possible to make stock which stock shows some text? I mean:

stock ServerReasons(reasonid) {
switch(reasonid) {
case 0: //there will be that text
case 1: //other text etc

I will use that for server logs. Sorry if is incomprehensible but now I can't think very well.

29/04/2015, 03:04 PM
stock acts like normal function, but if you don't use in the script then is not compiled, saving memory. If you want to show text then each case has to include: SendClientMessage or similar...

// perhaps you need loop players and select those you want to send text
// or even return the text

29/04/2015, 03:10 PM
@alexus You don't understand me. I want to send texts to files not to players

29/04/2015, 03:13 PM
You can also do that, no matter if is in a stock function. As I said stock is a normal function you pass paramethers and get results (save in a file or send to chat)

29/04/2015, 03:13 PM
Explain more?!


29/04/2015, 03:15 PM
Something like this

stock ServerReasons(reasonid) {
switch(reasonid) {
case 0: "Incorrect password.";
return 1;

write in kick log:

Kicklog(playerid, ServerReasons(0));

and then in the kick log is something like this:
playerid was kicked by the server. Reason: Incorrect password.

29/04/2015, 03:19 PM
You don't need a function for that, define a simple array with the messages

new ServerReasons[][] = {
"Reason 1",
"Reason 2",
"Reason n"};

Kicklog(playerid, ServerReasons[i]);