17.03.2010, 21:20
Hope this will help you
O.K. First Of All This is a detailed Tutorial, everything riped in parts ! so if youre a total beginner this should help you too!
O.K. First Start PAWN Scripter in : YourSampServerDirectory/pawno/pawno.exe [INFO : if youre a vista/win 7 user you must rightclick -> Run As Administrator]
[WARRNING : please use samp 0.3a and the samp 0.3a server files or else you might get some errors!]
now press the "New" Icon or : Files -> New
now select all and delete it by pressing backspace or rightclicking the selected and delete .
First lets start with the basic but verry important line ( this declears that we will use SAMP functions witch include all : a_file.inc ... ) :
Put this at the beginning after nothing is writen in the editor :
also after this declare these things [ VERRY IMPORTANT ] :
put that after the #include <a_samp> line!
after that add this at our last line :
now lets split this!
this checks if we use $ at the lenght : 0 that means on the begining if $ stands do the next thing :
new = create a new varible/string/bool
the name we set is : string it can be truly anything!
GetPlayerName =
this will compress a players name witch is : "playerid" in the OnPlayerText(playerid, text);
string is the varible or string that were gonna use .
sizeof(string) = we need the maximum length for the formation of "string" , so we ask to recive string's max length !
in this case : [128] is our max lenghtright there!
O.K. lets move on .
format is proccesing a formation of a var / string !
so it formats string and the same thing like GetPlayerName ! now this "Admin Chat: %s: %s" the %s is for : replace this with folowing string . %d is : replace this with folowing declaration . %i is : replace this with folowing integer ( number ) .
but how it knows what string ? here :
so the first replace is : string, the second is the text we wrote from the lenght 1 and later on . so $ wont be added .
now this a important part but doesnt actually mater to explain it...maybe some other time..sorry..
ok..after you copied the full code :
and after that this code ( because SendMessageToRAdmins doesnt exist yet ^^ ) :
congratulations youve made it!
but if you want to add it in the script dont delete all!
full pawn code :
hope it helped you!
O.K. First Of All This is a detailed Tutorial, everything riped in parts ! so if youre a total beginner this should help you too!
O.K. First Start PAWN Scripter in : YourSampServerDirectory/pawno/pawno.exe [INFO : if youre a vista/win 7 user you must rightclick -> Run As Administrator]
[WARRNING : please use samp 0.3a and the samp 0.3a server files or else you might get some errors!]
now press the "New" Icon or : Files -> New
now select all and delete it by pressing backspace or rightclicking the selected and delete .
First lets start with the basic but verry important line ( this declears that we will use SAMP functions witch include all : a_file.inc ... ) :
Put this at the beginning after nothing is writen in the editor :
pawn Код:
#include <a_samp>
pawn Код:
#define red 0xFF0000AA
after that add this at our last line :
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '$' && IsPlayerAdmin(playerd)) {
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); SendMessageToRAdmins(red,string);
return 0;
}
pawn Код:
if (text[0] == '$')
pawn Код:
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); SendMessageToRAdmins(red,string);
the name we set is : string it can be truly anything!
GetPlayerName =
this will compress a players name witch is : "playerid" in the OnPlayerText(playerid, text);
string is the varible or string that were gonna use .
sizeof(string) = we need the maximum length for the formation of "string" , so we ask to recive string's max length !
in this case : [128] is our max lenghtright there!
O.K. lets move on .
format is proccesing a formation of a var / string !
so it formats string and the same thing like GetPlayerName ! now this "Admin Chat: %s: %s" the %s is for : replace this with folowing string . %d is : replace this with folowing declaration . %i is : replace this with folowing integer ( number ) .
but how it knows what string ? here :
pawn Код:
string,text[1]
now this a important part but doesnt actually mater to explain it...maybe some other time..sorry..
ok..after you copied the full code :
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '$' && IsPlayerAdmin(playerd)) {
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); SendMessageToRAdmins(red,string);
return 0;
}
pawn Код:
stock SendMessageToRAdmins(color,const msg[])
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerAdmin(i)) SendClientMessage(i,color,msg);
}
}
but if you want to add it in the script dont delete all!
full pawn code :
pawn Код:
#include <a_samp>
#define red 0xFF0000AA
public OnPlayerText(playerid, text[])
{
if(text[0] == '$' && IsPlayerAdmin(playerd)) {
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); SendMessageToRAdmins(red,string);
return 0;
}
stock SendMessageToRAdmins(color,const msg[])
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerAdmin(i)) SendClientMessage(i,color,msg);
}
}