[FilterScript] Simple Speedboost system with command
#1

Код:
#include <a_samp>
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREEN 0x33AA33AA
//speedboost
new att[MAX_PLAYERS];
new Text:Textdraw0;
ON GAME MODE INIT
Код:
Textdraw0 = TextDrawCreate(127.000000, 417.000000, "SPEEDBOOST ENBLED");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.390000, 1.200000);
TextDrawColor(Textdraw0, -16711681);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 0);
ON PLAYER CONNECT
Код:
att[playerid] = false;
TextDrawHideForPlayer(playerid,Textdraw0);
ON PLAYER COMMAND TEXT
Код:
if (strcmp(cmdtext,"/speed", true) == 0)
{
if(att[playerid])
		{
            if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid,COLOR_ORANGE,"You aren't in a car.");
			att[playerid] = false;
			SendClientMessage(playerid, COLOR_GREEN, "You have disabled speedboost. Type /speed to enable it.");
			TextDrawHideForPlayer(playerid,Textdraw0);

		}
		else
		{
		    if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid,COLOR_ORANGE,"You aren't in a car.");
			att[playerid] = true;
			SendClientMessage(playerid, COLOR_GREEN, "You have enabled speedbost. Type /speed to disable it.");
			TextDrawShowForPlayer(playerid,Textdraw0);
		}
return 1;
}
return 0;
}
ONPLAYER ENTER VEHICLE
Код:
if( att[playerid] == 1)
{
TextDrawShowForPlayer(playerid,Textdraw0);
SendClientMessage(playerid, COLOR_ORANGE, "Type /speed to enable or disable speedbost.");
}
SendClientMessage(playerid, COLOR_ORANGE, "Type /speed to enable or disable speedbost.");
return 1;
}
ONPLAYER EXIT VEHICLE
Код:
if( att[playerid] == 1)
{
TextDrawHideForPlayer(playerid,Textdraw0);
}
return 1;
}
OnPlayerKeyStateChange
Код:
if( att[playerid] == 0) return 0;

if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
	new Float:x, Float:y, Float:z;
	GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
	SetVehicleVelocity(GetPlayerVehicleID(playerid), x * 3, y * 3, z * 3);
		}
    }
return 1;
}
sp.pwn
sp.amx
Reply


Messages In This Thread
Simple Speedboost system with command - by XxXBr0nXxX - 10.07.2013, 02:18
Re: Simple Speedboost system with command - by hossa - 10.07.2013, 02:25
Re: Simple Speedboost system with command - by n0minal - 10.07.2013, 02:53
Re: Simple Speedboost system with command - by Sandiel - 10.07.2013, 03:33

Forum Jump:


Users browsing this thread: 2 Guest(s)