How to create a onplayerconnect filterscript
#1

Hi i want to know how to make it eg.

i did it in this manner

#include <a_samp>

#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" ANNOUNCE Filterscript by Rockers");
print("--------------------------------------\n");
return 1;
}
public OnPlayerConnect(playerid)
{
SendPlayerMessage("Welcome to our server plz type /register or /login.");
return 1;
}
#endif

error comes
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(16) : error 017: undefined symbol "SendPlayerMessage"
plz help me plz
Reply
#2

Replace SendPlayerMessage with SendClientMessage

Edit - forgot, so the new code comes like this under SendClientMessage

pawn Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, COLOR_GREEN, "Welcome to our server plz type /register or /login.");
    return 1;
}
Also, after #define a_samp, do #define COLOR_GREEN a space after.

SendPlayerMessage is now SendClientMessage, so the code above sends a text to every player on connection, the text provided in a green colour. Hope this helps. Also, look on Color embedding, if you want to add multiple colours.
Reply
#3

Quote:
Originally Posted by Bikken
Посмотреть сообщение
Replace SendPlayerMessage with SendClientMessage

Edit - forgot, so the new code comes like this under SendClientMessage

pawn Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, COLOR_GREEN, "Welcome to our server plz type /register or /login.");
    return 1;
}
Also, after #define a_samp, do #define COLOR_GREEN a space after.

SendPlayerMessage is now SendClientMessage, so the code above sends a text to every player on connection, the text provided in a green colour. Hope this helps. Also, look on Color embedding, if you want to add multiple colours.
error comes D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(16) : error 017: undefined symbol "COLOR_GREEN"
Reply
#4

Under #define a_samp and all your defines, the code should go like

pawn Код:
define <a_samp>

// And then, the color defines come down

#define COLOR_GREEN
Reply
#5

D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1) : error 074: #define pattern must start with an alphabetic character
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(11) : warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(13) : error 017: undefined symbol "print"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(14) : error 017: undefined symbol "print"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(15) : error 017: undefined symbol "print"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1 : warning 235: public function lacks forward declaration (symbol "OnPlayerConnect")
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(20) : error 017: undefined symbol "SendClientMessage"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(20) : warning 215: expression has no effect
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(20) : error 001: expected token: ";", but found ")"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(20) : error 029: invalid expression, assumed zero
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(20) : fatal error 107: too many error messages on one line

errors coming
ibeg u plz can u post the full pawn code plz i beg u?
Reply
#6

pawn Код:
#include <a_samp>

#define COLOR_GREEN 0x33AA33AA

#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" ANNOUNCE Filterscript by Rockers");
print("--------------------------------------\n");
return 1;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_GREEN, "Welcome to our server plz type /register or /login.");
return 1;
}
Try this.
Reply
#7

sorry if i am annoying u but again error occured

D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1 : error 029: invalid expression, assumed zero
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1 : error 029: invalid expression, assumed zero
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1 : error 017: undefined symbol "FF00"
D:\Sa-MP SERVER\The Ultimate Freeroam\The Ultimate Freeroam\pawno\announce.pwn(1 : fatal error 107: too many error messages on one line
Reply
#8

Updated above code, did normal green hex code ID, my bad

Anyways, just settled it to a acceptable green color ID. Try now
Reply
#9

pawn Код:
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,-1,"Welcome to my server"); // Replace -1 with your colour, -1 = White.
return 1;
}
Reply
#10

Still have the issue?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)