SA-MP Forums Archive
[FilterScript] Welcome&Info [my first fs] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Welcome&Info [my first fs] (/showthread.php?tid=435550)



Welcome&Info [my first fs] - Christian7073 - 07.05.2013

Hello,Today I Created my first fs!
The: Welcome&Info!

I put this in fs that appears when you connect a welcome message and when they appear spawni your information! I inserted a high anti ping created by me, easily xD

Italian:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
#define VERDE 			0x21DD00FF
#define ROSSO           0xE60000FF
////////////////////////////////////////////////////////////////////////////////
#define PING 1500
////////////////////////////////////////////////////////////////////////////////


public OnPlayerConnect(playerid)
{
    if(GetPlayerPing(playerid) > PING)
	{
	 new kick[1000];
     format(kick,sizeof(kick),"[Info:] Sei stato kickato per ping molto alto! il massimo и di %d e tu hai fatto %d",PING,GetPlayerPing(playerid));
     SendClientMessage(playerid,0xFFFFFFAA,kick);
     Kick(playerid);
    }
    new string[64], nomeb[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nomeb,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s и entrato in London City DeathMatch!",nomeb);
    SendClientMessageToAll(VERDE,string);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        nomeu[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nomeu,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s и uscito da London City DeathMatch!",nomeu);
        case 1: format(string,sizeof string,"%s и uscito da London City DeathMatch!",nomeu);
        case 2: format(string,sizeof string,"%s и uscito da London City DeathMatch! [kickato/bannato]",nomeu);
    }
    SendClientMessageToAll(ROSSO,string);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new informazioni[1000];
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof (nome));
    format(informazioni,sizeof(informazioni),"[Info:] Benvenuto %s! Hai: %d punti - %d$ - sei id %d",nome,GetPlayerScore(playerid),GetPlayerMoney(playerid),playerid);
    SendClientMessage(playerid,0xFFFFFFAA,informazioni);
	return 1;
}
English:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
#define VERDE 			0x21DD00FF
#define ROSSO           0xE60000FF
////////////////////////////////////////////////////////////////////////////////
#define PING 1500
////////////////////////////////////////////////////////////////////////////////


public OnPlayerConnect(playerid)
{
    if(GetPlayerPing(playerid) > PING)
	{
	 new kick[1000];
     format(kick,sizeof(kick),"[Info:] You are kicked for high ping [%d] your ping is %d",PING,GetPlayerPing(playerid));
     SendClientMessage(playerid,0xFFFFFFAA,kick);
     Kick(playerid);
    }
    new string[64], nomeb[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nomeb,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s are logged in on London City Deathmatch!",nomeb);
    SendClientMessageToAll(VERDE,string);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        nomeu[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nomeu,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s are slogged by London City Deathmatch!",nomeu);
        case 1: format(string,sizeof string,"%s are slogged by London City Deathmatch!",nomeu);
        case 2: format(string,sizeof string,"%s are slogged by London City Deathmatch! [kicked/banned]",nomeu);
    }
    SendClientMessageToAll(ROSSO,string);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new informazioni[1000];
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof (nome));
    format(informazioni,sizeof(informazioni),"[Info:] Welcome %s! You Have: %d points - %d$ - your level is %d",nome,GetPlayerScore(playerid),GetPlayerMoney(playerid),playerid);
    SendClientMessage(playerid,0xFFFFFFAA,informazioni);
	return 1;
}
Bye and sorry for my bad english!



Re: Welcome&Info [my first fs] - SampN - 07.05.2013

Nice.


Re: Welcome&Info [my first fs] - Christian7073 - 07.05.2013

Quote:
Originally Posted by SampN
Посмотреть сообщение
Nice.
thank you


Re: Welcome&Info [my first fs] - Lordzy - 07.05.2013

Not bad as this is your first, but such small codes can be posted in Useful snippets. And btw, you don't need to set the string's size to 1000 for this. It's just using alot of usage. A client message, just sends 128 length of characters, so the size being 128 is better. And also, for ping testing, use a timer which repeats and counts the way of going.

And, why do you put any other server's name as welcome? ;o


Re: Welcome&Info [my first fs] - Mark_Samp - 07.05.2013

very simple but the string's size is too big and you don't need all this as Lordz said
But not bad for your first filterscript


Re: Welcome&Info [my first fs] - Christian7073 - 07.05.2013

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Not bad as this is your first, but such small codes can be posted in Useful snippets. And btw, you don't need to set the string's size to 1000 for this. It's just using alot of usage. A client message, just sends 128 length of characters, so the size being 128 is better. And also, for ping testing, use a timer which repeats and counts the way of going.

And, why do you put any other server's name as welcome? ;o
because I'm creating a gamemode called London City DM, sorry for the mistake!
the next version will be better.


Re: Welcome&Info [my first fs] - Deathlane - 08.05.2013

Quote:
Originally Posted by Christian7073
Посмотреть сообщение
because I'm creating a gamemode called London City DM, sorry for the mistake!
the next version will be better.
Editing your post will be better. Anyways, good job..