Small help, please! +rep - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small help, please! +rep (
/showthread.php?tid=572544)
Small help, please! +rep -
bgedition - 29.04.2015
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
Respuesta: Small help, please! +rep -
alexus - 29.04.2015
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(.....
Re: Small help, please! +rep -
bgedition - 29.04.2015
@alexus You don't understand me. I want to send texts to files not to players
Respuesta: Small help, please! +rep -
alexus - 29.04.2015
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)
Re: Small help, please! +rep -
[KHK]Khalid - 29.04.2015
Explain more?!
https://sampwiki.blast.hk/wiki/File_Functions
Re: Small help, please! +rep -
bgedition - 29.04.2015
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.
Respuesta: Small help, please! +rep -
alexus - 29.04.2015
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]);