Stock/public
#1

SOLVED
Reply
#2

"WelcomeTo(color, text[])" ? Well, you need to define a playerid. You can't just send a text message to noone ? Explain better what exactly you want this function to do ?
Reply
#3

A stock function is a function that can only be called by the script which it is in. A public function can be called from other scripts with CallRemoteFunction (or the same script with CallLocalFunction or just calling it like 'OnPlayerSpawn(playerid);'.

I'm not sure exactly what you want, but here's what I assume you want, or thereabouts:

pawn Код:
stock WelcomeTo(color, msg[])
{
    new formatted_msg[128];
    format(formatted_msg, sizeof(formatted_msg), "Welcome to %s!", msg);
    SendClientMessage(playerid, color, formatted_msg);
}
Reply
#4

SOLVED
Reply
#5

you will be needing an destination[playerid] here WelcomeTo(color,"blahblah");. if u wanna send message to particular player
so stock will be;
pawn Код:
stock WelcomeTo(playerid,color,string[])
{
SendClientMessage(playerid,color,string);
}
which makes no diffence though so instead of stock use macro
pawn Код:
#define WelcomeTo(%1,%2,%3) SendClientMessage(%1,%2,%3)
Edit:
Quote:
Originally Posted by vassilis
Посмотреть сообщение
Simple exampple:

instead of writing:
SendClientMessage(playerid,colorhere,"Welcome to Four Dragons Casino");
i would like to convert it to
WelcomeTo(colorhere,"Four Dragons Casino");
that wont work lol you can create
WelcomeTo(playerid,"{FFFFF}Four Dragons Casino"); instead
Reply
#6

SOLVED
Reply
#7

The answer has been given.
Quote:
Originally Posted by MP2
Посмотреть сообщение
pawn Код:
stock WelcomeTo(color, msg[])
{
    new formatted_msg[128];
    format(formatted_msg, sizeof(formatted_msg), "Welcome to %s!", msg);
    SendClientMessage(playerid, color, formatted_msg);
}
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
I hadn't seen those replies - there was only one when I started writing my reply sorry (although my point that you didn't actually originally ask anything still stands). If you were just asking how to write basic functions, why didn't you check pawn-lang.pdf and the wiki first? Also, if you are writing functions for your mode you don't need "stock" or "public", you can just have normal functions.
Ok thanks for help anyway.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)