SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 22/01/2008, 03:57 PM   #121
Rafelder_GRF
Big Clucker
 
Join Date: Sep 2007
Posts: 76
Reputation: 14
Default Re: Useful Snippets

I hate to use SendRconCommand to set the mapname.
So i scripted this little function.
pawn Code:
stock SetGameMapName(const mapname[])
{
    new string[256];
    format(string, sizeof(string), "mapname %s", mapname);
    SendRconCommand(string);
}
Rafelder_GRF is offline   Reply With Quote
Old 15/02/2008, 09:21 PM   #122
FujiNNN
Huge Clucker
 
FujiNNN's Avatar
 
Join Date: Aug 2006
Location: Russia, Moscow
Posts: 236
Reputation: 0
Default Re: Useful Snippets

Simple Advertiser
by: fujinnn

that script will advertise evry 5 minutes (*you can change) all that you want!

Top of your script:
Code:
forward AutoMsg();
OnGameModeInit()
Code:
SetTimer("AutoMsg",300000,1); // Auto message in evry 5 minutes
Create a new 'public' in the end or middle of your script
Code:
public AutoMsg()
{
	SendClientMessageToAll(0xFF1493AA, "SERVER: *Want to Advertise here? Contact fujinnn");
	return 1;
}
thats it! simple as hell..

[color=red]* that is my first release


enjoy!
FujiNNN is offline   Reply With Quote
Old 01/06/2008, 08:54 PM   #123
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 2,630
Reputation: 409
Default Re: Useful Snippets

Here is some random useless things for most people!
Prints all the text into 1 file:
Code:
public OnPlayerText(playerid, text[])
{
	new string[256], pname[24], File:ftw = fopen("Text.txt", io_append);
	GetPlayerName(playerid, pname, 24);
	format(string, sizeof (string), "%s:%s \r\n",pname,text);
	fwrite(ftw, string);
	fclose(ftw);
	return 1;
}
Prints all the PM's to a file:
Code:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	new string[256], pname[24],pname1[24], File:ftw = fopen("PM's.txt", io_append);
	GetPlayerName(playerid, pname, 24);
	GetPlayerName(recieverid, pname, 24);
	format(string, sizeof (string), "From:%s To:%s Message:%s \r\n",pname,pname1,text);
	fwrite(ftw, string);
	fclose(ftw);
	return 1;
}
Prints all the typed commands to a file:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256], pname[24], File:ftw = fopen("Commands.txt", io_append);
	GetPlayerName(playerid, pname, 24);
	format(string, sizeof (string), "Command:%s Used By:%s \r\n",cmdtext,pname);
	fwrite(ftw, string);
	fclose(ftw);
	return 1;
}
__________________
[HiC]TheKiller is offline   Reply With Quote
Old 11/06/2008, 04:47 PM   #124
boemeles
Big Clucker
 
Join Date: Aug 2007
Posts: 135
Reputation: 1
Default Re: Useful Snippets

Count Vehicles In Server

PasteBin link, for ready to use FS

Displays how many vehicles are in your server, only way i could think of, and no fancy shit

news:
pawn Code:
new CounterID, Count, String[32];

command:
pawn Code:
if(!strcmp(cmdtext, "/countcars", true, 10))
    {
      CounterID = playerid;
      for(new i = 0; i < MAX_VEHICLES; i ++)
        SetVehicleToRespawn(i);
      SetTimer("DisplayVehicles", 5000, 0);
      return 1;
    }

Put this in OnVehicleSpawn:
pawn Code:
Count = vehicleid;

And the function to display the amount of cars:
pawn Code:
forward DisplayVehicles();
public DisplayVehicles()
{
    format(String, sizeof(String), "%d Vehicles counted", Count);
    SendClientMessage(CounterID, 0xFFFFFF, String);
}

Im pretty sure someone else's thought of this already, but here is it in the Useful Snippets topic!

EDIT: can this topic be stickied too?
boemeles is offline   Reply With Quote
Old 25/07/2008, 08:30 AM   #125
djnitro
Little Clucker
 
Join Date: Jan 2008
Posts: 4
Reputation: 0
Default Re: Useful Snippets

I made a vehicle-counter Filterscript today . It has some more functions such as model counter and warnings.
And It's written easier without respawning cars or even touching them in any way!! And So u can even use it with all VehicleSlots Used!
DOWNLOAD HERE KLICK

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{

	if (strcmp("/carcheck", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid,0xFFFF00AA, "Carcheck introduced!");
	new Models[211]=0;
	new cars=0;
	new mods=0;
	for(new i; i<=MAX_VEHICLES;i++)
		{
			if(400<=GetVehicleModel(i)<=611)
			{
			  cars++;
			  Models[GetVehicleModel(i)-400]=1;
			}
		}
	for(new o;o<=210;o++)
	{
		if(Models[o]==1) mods++;
	}
	new message[256];
	format(message, sizeof(message), "%d cars with %d different models!", cars, mods);
	if(cars>=550)
		{
		  new message2[256];
		  new message21[256];
		  format(message2, sizeof(message2), "Remember you only have %d cars left", 700-cars);
 		  format(message21, sizeof(message21), "And only around %d stable.", 650-mods);
		  SendClientMessage(playerid, 0xFF6347AA, message2);
		  SendClientMessage(playerid, 0xFF6347AA, message21);
 		}
 	if(mods>=50)
		{
		  new message3[256];
		  new message31[256];
		  format(message3, sizeof(message3), "Remember you only have %d models left", 70-mods);
 		  format(message31, sizeof(message31), "And only around %d stable.", 65-mods);
		  SendClientMessage(playerid, 0xFF6347AA, message3);
 		  SendClientMessage(playerid, 0xFF6347AA, message31);
 		}
	SendClientMessage(playerid, 0xFFFF00AA, message);
	return 1;
	}
	return 0;
}
NOTE: this is part of a filterscript. If u wanna use it directly in your gamemode, u have to change the returns at OnPlayerCommandText!
djnitro is offline   Reply With Quote
Old 25/07/2008, 03:21 PM   #126
[D1zZy_vortex]
Big Clucker
 
Join Date: Jul 2008
Posts: 80
Reputation: 0
Default Re: Useful Snippets

To know ur Vehicle id :


Code:

 	if(strcmp(cmdtext, "/vid", true) == 0)
 		{
 		new tmp,str[256];
 		tmp = GetPlayerVehicleID(playerid);
 		format(str,256,"[INFO] Vehicle id: %d",tmp);
 		SendClientMessage(playerid, COLOR_YELLOW, str);
 		return 1;
 		}
[D1zZy_vortex] is offline   Reply With Quote
Old 08/09/2008, 10:31 AM   #127
Serediucr
Huge Clucker
 
Join Date: Jul 2008
Posts: 210
Reputation: 2
Default Re: Useful Snippets

Quote:
Originally Posted by Alejandro
Connect icon in DeathStats from ******
pawn Code:
public OnPlayerConnect(playerid)
{
  SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
  return 1;
}


Disconnect icon in DeathStats from ******
pawn Code:
public OnPlayerDisconnect(playerid)
{
  SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
}
the disconnect icon shows for me, but the connect icon wont show.
[/quote]
for me is don't showing any icon
Serediucr is offline   Reply With Quote
Old 06/10/2008, 12:57 PM   #128
JaTochNietDan
High-roller
 
JaTochNietDan's Avatar
 
Join Date: Apr 2007
Location: Republic of Ireland
Posts: 2,502
Reputation: 363
Default Re: Useful Snippets

Anti Labrik Spam
This is defense against the spamming tool which spams your server with "FUCK THIS SERVER" and also spams join/leave. True that it will ban anyone with this name but I don't think someone that uses this name in the first place should join your server. This should be 100% perfect if people do this to your server, as the first join name is Labrik and the first IP is the attackers IP instead of the fake IP's that appear most of the time afterwards.

pawn Code:
public OnPlayerConnect(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
if(!strcmp("[ViP]Labrik",name,true))
{
Ban(playerid);
}
return 1;
}
__________________
Releases:
[Includes]: [jBan] | [jBanLite]
[Plugins]: [FileManager] | [Execute]
[Applications]: [Remote Administrator *NEW] | [Script King] | [RCON GUI]
JaTochNietDan is offline   Reply With Quote
Old 07/10/2008, 01:33 AM   #129
[ERP]Snow
Big Clucker
 
Join Date: Sep 2008
Posts: 79
Reputation: 0
Default Re: Useful Snippets

Quote:
Originally Posted by JaTochNietDan
Anti Labrik Spam
This is defense against the spamming tool which spams your server with "FUCK THIS SERVER" and also spams join/leave. True that it will ban anyone with this name but I don't think someone that uses this name in the first place should join your server. This should be 100% perfect if people do this to your server, as the first join name is Labrik and the first IP is the attackers IP instead of the fake IP's that appear most of the time afterwards.

pawn Code:
public OnPlayerConnect(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
if(!strcmp("[ViP]Labrik",name,true))
{
Ban(playerid);
}
return 1;
}
pawn Code:
public OnPlayerConnect(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
if(!strcmp("[MT]Lavis",name,true))
{
Ban(playerid);
}
return 1;
}
[ERP]Snow is offline   Reply With Quote
Old 07/10/2008, 09:11 PM   #130
Sandra18[NL]
Huge Clucker
 
Join Date: Jun 2007
Posts: 401
Reputation: 54
Default Re: Useful Snippets

Or:

//On top of your script:
Code:
new BannedNames[][MAX_PLAYER_NAME] = 
{
  "[ViP]Labrik", 
  "[MT]Lavis",
  "[XXX]Whatever"
}; //Add as much as you want.
Code:
public OnPlayerConnect(playerid)
{
  new Name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,sizeof(Name));
  for(new i; i<sizeof(BannedNames); i++)
  {
    if(strcmp(BannedNames[i],Name,true)==0)
    {
      Ban(playerid);
    }
  }
  return 1;
}
Sandra18[NL] is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
READ Usefull Links to snippets and other -Sneaky- Help Archive 5 02/05/2009 11:22 AM


All times are GMT. The time now is 06:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.