SA-MP Forums

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

Thread Tools Display Modes
Old 22/05/2018, 10:10 PM   #1
Little Clucker
Nickk888's Avatar
Join Date: Oct 2011
Location: Germany
Posts: 20
Reputation: 24
Thumbs up NDRIFT v1.0 - Dynamic Drift counting system [95% EDIT]

About Me:
Hello dear SA-MP community My name's Nickk888, i'm a German/Polish PAWN Scripter for about 6 years now, I own a ******* channel about SA-MP Scripting in Polish language and I create scripts for the public for free. Excuse my English skill, I'm no native English speaker, so please keep this in mind I'll try my best ^_^

About Include:
NDRIFT is a Include that basically calculates if someone is drifting and calls a Callback with the calculated Score.
This Include was a drifting Filterscript which author was Luby,
i've modified and optimized the code and Converted it to an Include.
You can Enable or Disable the Counter globally or Per-Player, check if someone is drifting and check if someone damaged the vehicle while drifting, all within 1 callback!

  • Easy to use!
  • Easy to activate!
  • Self hooking include, just include it!
  • Everything is done within the main Callback, drift start, drift end and scoring!
  • Easy to Set-Up!
  • Bug Free Calculation and callback calling!
  • Fast Tick Rate

CreateDriftCounter(tickrate, minspeed, Float:minangle, Float:maxangle); - Starts the drift calculation with given parameters.
DestroyDriftCounter(); - Stops/Destroys the drift calculation.
FinishDriftingPlayer(playerid, bool:callfinish); - Force Finish Player Drifting
IsPlayerDrifting(playerid); - Check if Player is drifting.
TogglePlayerDriftCounter(playerid, bool:activated); - Toggle drifting Calculation for the Player.
OnPlayerDrifting(playerid, vehicleid, score, driftstate); - Is calling when player is drifting.
DRIFT_DEFAULT_FINISH_TICKRATE - Default tickrate to stop the drift counter if player is not drifting.
DRIFT_DEFAULT_MIN_ANGLE - Minimum angle for the drift calculation.
DRIFT_DEFAULT_MAX_ANGLE - Maximum angle for the drift calculation.
DRIFT_DEFAULT_MIN_SPEED - The minimum speed required to take drift score.
Callback drift states:
DRIFT_STATE_DRIFTING - Player is still drifting(Drift Update)
DRIFT_STATE_START - Player started drifting.
DRIFT_STATE_FINISH - Player finished the drift(Not drifting for about 3 seconds)
DRIFT_STATE_VEHICLEDAMAGED - Player damaged the vehicle.
How to use it:
Just open the example script within the package!
#include <a_samp>
#include <ndrift>

new DriftScore[MAX_PLAYERS]; //Players score Pool, here we store the drift reward.
new PlayerText:td[MAX_PLAYERS]; //TextDraw variable.

public OnFilterScriptInit()
	CreateDriftCounter(); //Activated the whole system
	return 1;

hook OnPlayerConnect(playerid)
	//Counter TextDraw
	td[playerid] = CreatePlayerTextDraw(playerid,98.000000, 360.000000, "~b~DRIFT~n~~y~SCORE: ~w~+13~n~~r~TOTAL: ~g~4587");
	PlayerTextDrawBackgroundColor(playerid,td[playerid], 255);
	PlayerTextDrawFont(playerid,td[playerid], 2);
	PlayerTextDrawLetterSize(playerid,td[playerid], 0.420000, 1.900000);
	PlayerTextDrawColor(playerid,td[playerid], -1);
	PlayerTextDrawSetOutline(playerid,td[playerid], 1);
	PlayerTextDrawSetProportional(playerid,td[playerid], 1);
	PlayerTextDrawUseBox(playerid,td[playerid], 1);
	PlayerTextDrawBoxColor(playerid,td[playerid], 50);
	PlayerTextDrawTextSize(playerid,td[playerid], 275.000000, 0.000000);
	PlayerTextDrawSetSelectable(playerid,td[playerid], 0);
	return 1;

hook OnPlayerDisconnect(playerid)
	PlayerTextDrawDestroy(playerid, td[playerid]); //Destroys the Counter TextDraw
	return 1;

public OnPlayerDrifting(playerid, vehicleid, score, driftstate)
	score *= 10; //Score multiplier, the higher the value is, the more score the player gets!
	new string[128];
		case DRIFT_STATE_VEHICLEDAMAGED: //Has the vehicle taking damage while drifting?
			FinishDriftingPlayer(playerid, false); //Forces the player counter to stop.
			GameTextForPlayer(playerid, "Vehicle damaged...~n~~r~DRIFT FAILED!", 2000, 1); //Show a text on the player's screen.
			PlayerTextDrawHide(playerid, td[playerid]); //Hides the counter TD
			DriftScore[playerid] = 0; //Resets the score counter.
		case DRIFT_STATE_FINISH: //If the drift has been finished
			GivePlayerMoney(playerid, DriftScore[playerid]); //Gives the player the score reward.
			PlayerTextDrawHide(playerid, td[playerid]); //Hides the counter TD
			format(string, sizeof string, "~g~+$%i", DriftScore[playerid]); //Formats the string
			GameTextForPlayer(playerid, string, 2000, 1); //Show a text on the player's screen.
			DriftScore[playerid] = 0; //Resets the score counter.
		case DRIFT_STATE_DRIFTING, DRIFT_STATE_START: //Is player drifting(Main drift Update)
			DriftScore[playerid] += score; //Adds the score to the reward pool.
			format(string, sizeof string, "~b~DRIFT~n~~y~SCORE: ~w~+%i~n~~r~TOTAL: ~g~%i", score, DriftScore[playerid]);  //Formats the string
			PlayerTextDrawSetString(playerid, td[playerid], string); //Formats the string
			PlayerTextDrawShow(playerid, td[playerid]); //Updates the counter TD.
	return 1;
Version 1.0:
- First Release


a_samp: SAMP Team
Y_Hooks: Y_Less
Luby for the filterscript i could edit.

Last edited by Nickk888; 24/05/2018 at 03:26 PM.
Nickk888 is offline   Reply With Quote
Old 23/05/2018, 03:20 AM   #2
Uproar's Avatar
Join Date: Feb 2018
Location: India
Posts: 559
Reputation: 134
Default Re: NDRIFT v1.0 - Dynamic Drift counting system [95% EDIT]

Looks good and you've some great content on your YT channel. I loved it. Great job!
Uproar is offline   Reply With Quote
Old 23/05/2018, 06:53 AM   #3
RogueDrifter's Avatar
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,148
Reputation: 345
Default Re: NDRIFT v1.0 - Dynamic Drift counting system [95% EDIT]

Nice better than iKarim's! (just kidding) but still good job! will +rep u once i can.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link

RogueDrifter is offline   Reply With Quote

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
[FilterScript] Dynamic Object Edit-Save-Load-Delete system. Roel Filterscripts 36 04/06/2018 08:53 AM
[FilterScript] Advanced Super Dynamic Kills & Deaths Counting and Storing Modification Combined With Relatively Simple Login System iMonk3y Filterscripts 32 21/06/2013 01:14 PM

All times are GMT. The time now is 12:34 AM.

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