31.07.2012, 20:32
try at the end of the script.. 
for example in this script

for example in this script
pawn Код:
#include <a_samp>
#include <Colors>
#include <zcmd>
#include <dini>
#pragma tabsize 0
//definining the color
#define color COLOR_RED // replace RED with BLUE or your color ;)
#define JoinFile "Join.ini"
#define LeaveFile "Leave.ini"
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//==============================================================================
/*
me - for creating this script, and for color include
Zeex for zcmd
Dracoblue for dini
sa-mpteam - for all sa-mp functions and callback
*/
/*
This is a simple FIlterscript, JoinLeaveCreater with this you can create your own JoinLeave message
Why to create this? : to be honest that was a ideea , but now i don't think so this will be soo usefull,
Script created by XSTORMIEST
*/
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Free In-Game Converter Online");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
}
CMD:jlmsg(playerid,params[])
{
if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"This cmd is only for owner!!");
else ShowPlayerDialog(playerid,47,DIALOG_STYLE_LIST,"Join Leave Creator", "Join Message\nLeave Message","Select","Cancel");
return 1;
}
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
if(dialogid == 47)
{
if(!response) return 1;
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid,56,DIALOG_STYLE_INPUT,"Join Message","Please write the text you want to write.! please use format %s for your text:\nExample: Welcome , %s joined to the server","Create","Cancel");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid,57,DIALOG_STYLE_INPUT,"Leave Message","Please write the text you want to write.! please use format %s for your text:\nExample: %s had left the server","Next","Cancel");
}
}
}
if(dialogid == 56)
{
if(!response) return 1;
if(response)
{
new name[MAX_PLAYER_NAME], string[256];
format(string,sizeof(string), "Add this under OnPlayerConnect(playerid): =>>\r\nnew name[MAX_PLAYER_NAE], string[256];\r\nGetPlayerName(playerid,name,sizef(name));\r\nformat(string,sizeof(string),'%s',name);\r\nSendClientMessage(playerid,color,string); ",inputtext[0],name[0]);
new File: file;
file = fopen(JoinFile,io_append);
if(file)
{
fwrite(file,string);
fclose(file);
}
SendClientMessage(playerid,COLOR_YELLOW,"File created! check scriptfile at Join.ini");
}
}
if(dialogid == 57)
{
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"Add this under OnPlayerDisconnect(playerid,reason)\r\nnew name[MAX_PLAYER_NAME],string[256]\r\nGetPlayerName(playerid,name,sizeof(name));\r\nformat(string,sizzeof(string),'%s',name);\r\nSendClientMessage(playerid,color,string);",inputtext[0]);
new File: file;
file = fopen(LeaveFile,io_append);
if(file)
{
fwrite(file,string);
fclose(file);
}
SendClientMessage(playerid,COLOR_YELLOW,"File created! check scriptfile at Leave.ini");
}
return 1;
}
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
stock GetPlayerNameEx(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}