Small help, please! +rep
#1

Hello everybody!
I want to ask you - is it possible to make stock which stock shows some text? I mean:
pawn Код:
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.
+rep
BGEdition
Reply
#2

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...

Код:
case0:
{
// perhaps you need loop players and select those you want to send text
// or even return the text
SendClientMessageToAll(.....
Reply
#3

@alexus You don't understand me. I want to send texts to files not to players
Reply
#4

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)
Reply
#5

Explain more?!

https://sampwiki.blast.hk/wiki/File_Functions
Reply
#6

Something like this
pawn Код:
stock ServerReasons(reasonid) {
    switch(reasonid) {
        case 0: "Incorrect password.";
}
   return 1;
write in kick log:
pawn Код:
Kicklog(playerid, ServerReasons(0));
and then in the kick log is something like this:
playerid was kicked by the server. Reason: Incorrect password.
Reply
#7

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]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)