[FilterScript] Elevators
#1

Код:
#include <a_samp>
#include <colors>

#undef MAX_PLAYERS
#define MAX_PLAYERS 20

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

new El[MAX_PLAYERS];
new bool:Elespawned[MAX_PLAYERS];
new speed = 10;
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

public OnFilterScriptInit()
{
	print("Elevators by iToast");
	return 1;
}

public OnFilterScriptExit()
{
	for(new i=0; i< MAX_PLAYERS; i++)
	{
		if(Elespawned[i])
		{
			DestroyObject(El[i]);
			Elespawned[i] = false;
		}
	}
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	if(Elespawned[playerid])
	{
		DestroyObject(El[playerid]);
		Elespawned[playerid] = false;
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(Elespawned[playerid])
	{
		DestroyObject(El[playerid]);
		Elespawned[playerid] = false;
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(mel, 3, cmdtext);
	dcmd(rele, 4, cmdtext);
	dcmd(el, 2, cmdtext);
	return false;
}

dcmd_mel(playerid, params[])
{
	if(Elespawned[playerid])
	{
	    if(strlen(params) > 0)
	    {
		    new tmp1[256], idx, tmp2[256], tmp3[256];
			tmp1 = strtok(params, idx);
			tmp2 = strtok(params, idx);
			tmp3 = strtok(params, idx);
			new Float:x=floatstr(tmp1), Float:y=floatstr(tmp2), Float:z=floatstr(tmp3);
			MoveObject(El[playerid], x, y, z, speed);
			SendClientMessage(playerid, COLOR_GREEN, "Elevator moving...");
			}else{
			    SendClientMessage(playerid, COLOR_RED, "Useage: /mel x y z");
			}
		}else{
			SendClientMessage(playerid, COLOR_RED, "You must first make a elevator with /el!");
	}
	return 1;
}

dcmd_rele(playerid, params[])
{
	#pragma unused params
	if(Elespawned[playerid])
	{
		DestroyObject(El[playerid]);
		SendClientMessage(playerid, COLOR_GREEN, "Elevator destroyed!");
		Elespawned[playerid] = false;
	}else{
		SendClientMessage(playerid, COLOR_RED, "You must first make a elevator with /el!");
	}
	return 1;
}

dcmd_el(playerid, params[])
{
	#pragma unused params
	if(!Elespawned[playerid])
	{
		new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);
		El[playerid] = CreateObject(18755, x, y, z+2, 0.0, 0.0, 96.0);
		SetPlayerPos(playerid, x, y, z+2);
		SendClientMessage(playerid, COLOR_GREEN, "Enjoy your elevator!");
		Elespawned[playerid] = true;
	}else{
	    SendClientMessage(playerid, COLOR_RED, "You already have a elevator, destroy it with /rele!");
	}
	return 1;
}
If you want to try the script, join this server!

Код:
76.67.113.42:7777
Also, colors.inc is this

Код:
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
//#define COLOR_SEAGREEN 0x2E8B57AA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define OBJECTIVE_COLOR 0x64000064
#define TEAM_GREEN_COLOR 0xFFFFFFAA
#define TEAM_BLUE_COLOR 0x8D8DFFAA
#define COLOR_ADD 0x63FF60AA
#define TEAM_CYAN_COLOR 0xFF8282AA
#define TEAM_ORANGE_COLOR 0xFF8300C8
#define TEAM_ORANGE1_COLOR 0xFF830099
#define TEAM_ORANGE2_COLOR 0xFF830088
#define TEAM_ORANGE3_COLOR 0xFF830077
#define TEAM_ORANGE4_COLOR 0xFF830066
#define TEAM_ORANGE5_COLOR 0xFF830055
#define TEAM_ORANGE6_COLOR 0xFF830044
#define TEAM_ORANGE7_COLOR 0xFF830033
#define TEAM_ORANGE8_COLOR 0xFF830022
#define TEAM_ORANGE9_COLOR 0xFF830011
#define TEAM_ORANGE10_COLOR 0xFF830000
#define TEAM_BALLAS_COLOR 0xD900D3C8
#define TEAM_BALLAS1_COLOR 0xD900D399
#define TEAM_BALLAS2_COLOR 0xD900D388
#define TEAM_BALLAS3_COLOR 0xD900D377
#define TEAM_BALLAS4_COLOR 0xD900D366
#define TEAM_BALLAS5_COLOR 0xD900D355
#define TEAM_BALLAS6_COLOR 0xD900D344
#define TEAM_BALLAS7_COLOR 0xD900D333
#define TEAM_BALLAS8_COLOR 0xD900D322
#define TEAM_BALLAS9_COLOR 0xD900D311
#define TEAM_BALLAS10_COLOR 0xD900D300
#define TEAM_GROVE_COLOR 0x00D900C8
#define TEAM_GROVE1_COLOR 0x00D90099
#define TEAM_GROVE2_COLOR 0x00D90088
#define TEAM_GROVE3_COLOR 0x00D90077
#define TEAM_GROVE4_COLOR 0x00D90066
#define TEAM_GROVE5_COLOR 0x00D90055
#define TEAM_GROVE6_COLOR 0x00D90044
#define TEAM_GROVE7_COLOR 0x00D90033
#define TEAM_GROVE8_COLOR 0x00D90022
#define TEAM_GROVE9_COLOR 0x00D90011
#define TEAM_GROVE10_COLOR 0x00D90000
#define TEAM_VAGOS_COLOR 0xFFC801C8
#define TEAM_VAGOS1_COLOR 0xFFC80199
#define TEAM_VAGOS2_COLOR 0xFFC80188
#define TEAM_VAGOS3_COLOR 0xFFC80177
#define TEAM_VAGOS4_COLOR 0xFFC80166
#define TEAM_VAGOS5_COLOR 0xFFC80155
#define TEAM_VAGOS6_COLOR 0xFFC80144
#define TEAM_VAGOS7_COLOR 0xFFC80133
#define TEAM_VAGOS8_COLOR 0xFFC80122
#define TEAM_VAGOS9_COLOR 0xFFC80111
#define TEAM_VAGOS10_COLOR 0xFFC80100
#define TEAM_AZTECAS_COLOR 0x01FCFFC8
#define TEAM_AZTECAS1_COLOR 0x01FCFF99
#define TEAM_AZTECAS2_COLOR 0x01FCFF88
#define TEAM_AZTECAS3_COLOR 0x01FCFF77
#define TEAM_AZTECAS4_COLOR 0x01FCFF66
#define TEAM_AZTECAS5_COLOR 0x01FCFF55
#define TEAM_AZTECAS6_COLOR 0x01FCFF44
#define TEAM_AZTECAS7_COLOR 0x01FCFF33
#define TEAM_AZTECAS8_COLOR 0x01FCFF22
#define TEAM_AZTECAS9_COLOR 0x01FCFF11
#define TEAM_AZTECAS10_COLOR 0x01FCFF00
#define TEAM_NANG_COLOR 0xBDCB92C8
#define TEAM_NANG1_COLOR 0xBDCB9299
#define TEAM_NANG2_COLOR 0xBDCB9288
#define TEAM_NANG3_COLOR 0xBDCB9277
#define TEAM_NANG4_COLOR 0xBDCB9266
#define TEAM_NANG5_COLOR 0xBDCB9255
#define TEAM_NANG6_COLOR 0xBDCB9244
#define TEAM_NANG7_COLOR 0xBDCB9233
#define TEAM_NANG8_COLOR 0xBDCB9222
#define TEAM_NANG9_COLOR 0xBDCB9211
#define TEAM_NANG10_COLOR 0xBDCB9200
#define TEAM_RIFA_COLOR 0x000000C8
#define TEAM_RIFA1_COLOR 0x00000099
#define TEAM_RIFA2_COLOR 0x00000088
#define TEAM_RIFA3_COLOR 0x00000077
#define TEAM_RIFA4_COLOR 0x00000066
#define TEAM_RIFA5_COLOR 0x00000055
#define TEAM_RIFA6_COLOR 0x00000044
#define TEAM_RIFA7_COLOR 0x00000033
#define TEAM_RIFA8_COLOR 0x00000044
#define TEAM_RIFA9_COLOR 0x00000055
#define TEAM_RIFA10_COLOR 0x00000066
#define TEAM_MAFIA_COLOR 0x9A9999C8
#define TEAM_MAFIA1_COLOR 0x9A999999
#define TEAM_MAFIA2_COLOR 0x9A999988
#define TEAM_MAFIA3_COLOR 0x9A999977
#define TEAM_MAFIA4_COLOR 0x9A999966
#define TEAM_MAFIA5_COLOR 0x9A999955
#define TEAM_MAFIA6_COLOR 0x9A999944
#define TEAM_MAFIA7_COLOR 0x9A999933
#define TEAM_MAFIA8_COLOR 0x9A999922
#define TEAM_MAFIA9_COLOR 0x9A999911
#define TEAM_MAFIA10_COLOR 0x9A999900
#define TEAM_RMAFIA_COLOR 0x916600C8
#define TEAM_RMAFIA1_COLOR 0x91660099
#define TEAM_RMAFIA2_COLOR 0x91660088
#define TEAM_RMAFIA3_COLOR 0x91660077
#define TEAM_RMAFIA4_COLOR 0x91660066
#define TEAM_RMAFIA5_COLOR 0x91660055
#define TEAM_RMAFIA6_COLOR 0x91660044
#define TEAM_RMAFIA7_COLOR 0x91660033
#define TEAM_RMAFIA8_COLOR 0x91660022
#define TEAM_RMAFIA9_COLOR 0x91660011
#define TEAM_RMAFIA10_COLOR 0x91660000
#define TEAM_TRIADS_COLOR 0x587B95C8
#define TEAM_TRIADS1_COLOR 0x587B9599
#define TEAM_TRIADS2_COLOR 0x587B9588
#define TEAM_TRIADS3_COLOR 0x587B9577
#define TEAM_TRIADS4_COLOR 0x587B9566
#define TEAM_TRIADS5_COLOR 0x587B9555
#define TEAM_TRIADS6_COLOR 0x587B9544
#define TEAM_TRIADS7_COLOR 0x587B9533
#define TEAM_TRIADS8_COLOR 0x587B9522
#define TEAM_TRIADS9_COLOR 0x587B9511
#define TEAM_TRIADS10_COLOR 0x587B9500
#define TEAM_BIKERS_COLOR 0xA49A00C8
#define TEAM_BIKERS1_COLOR 0xA49A0099
#define TEAM_BIKERS2_COLOR 0xA49A0088
#define TEAM_BIKERS3_COLOR 0xA49A0077
#define TEAM_BIKERS4_COLOR 0xA49A0066
#define TEAM_BIKERS5_COLOR 0xA49A0055
#define TEAM_BIKERS6_COLOR 0xA49A0044
#define TEAM_BIKERS7_COLOR 0xA49A0033
#define TEAM_BIKERS8_COLOR 0xA49A0022
#define TEAM_BIKERS9_COLOR 0xA49A0011
#define TEAM_BIKERS10_COLOR 0xA49A0000
#define COLOR_INVIS 0xAFAFAF00
#define COLOR_SPEC 0xBFC0C200
#define COLOR_ADMIN_PW 0x99CCFFAA
#define COLOR_ADMIN_CMD 0xCC6666AA
#define COLOR_ADMIN_PM 0x6699CCAA
#define COLOUR_PERSONAL  0x8080FFAA
#define COLOUR_IMPORTANT 0xFF0000AA
#define COLOUR_GLOBAL	0xD0D0FFAA
#define COLOUR_BROADCAST 0x0066CCAA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_IVORY 0xFFFF82FF
#define COLOR_PURPLE 0x800080FF
#define COLOR_LIGHTGREEN 0x00FF7FFF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_FIREBRICK 0xB22222FF
#define COLOR_LIGHTYELLOW 0xFAFA02FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_BRIGHTGREEN 0x7CFC00FF
#define COLOR_DARKBLUE 0x000080AFF
#define COLOR_VIOLETRED 0xDB7093FF
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_TURQUISE 0x48D1CCFF
#define COLOR_STEELBLUE 0xB0C4DEFF
#define COLOR_PLAYER_LIGHTBLUE 0x9292FFDD
#define COLOR_PLAYER_BLUE 0x0000FFDD
#define COLOR_PLAYER_DARKBLUE 0x000096DD
#define COLOR_PLAYER_SPECIALBLUE 0x4169FFDD
#define COLOR_PLAYER_LIGHTRED 0xFFB0B0DD
#define COLOR_PLAYER_RED 0xFF0000DD
#define COLOR_PLAYER_DARKRED 0xA10000DD
#define COLOR_PLAYER_SPECIALRED 0xB22222DD
#define COLOR_PLAYER_LIGHTGREEN 0x92FF92DD
#define COLOR_PLAYER_GREEN 0x00FF00DD
#define COLOR_PLAYER_DARKGREEN 0x009600DD
#define COLOR_PLAYER_SPECIALGREEN 0x7ACA7ADD
#define COLOR_PLAYER_LIGHTYELLOW 0xFFFF5EDD
#define COLOR_PLAYER_YELLOW 0xFFFF00DD
#define COLOR_PLAYER_DARKYELLOW 0xD3D300DD
#define COLOR_PLAYER_SPECIALYELLOW 0xCFAE00DD
#define COLOR_PLAYER_LIGHTPURPLE 0xFF92FFDD
#define COLOR_PLAYER_PURPLE 0xFF00FFDD
#define COLOR_PLAYER_DARKPURPLE 0x800080DD
#define COLOR_PLAYER_SPECIALPURPLE 0xDA70D6DD
#define COLOR_PLAYER_LIGHTBROWN 0xBA9072DD
#define COLOR_PLAYER_BROWN 0x8B4513DD
#define COLOR_PLAYER_DARKBROWN 0x6D360EDD
#define COLOR_PLAYER_LIGHTGREY 0xC7C7C7DD
#define COLOR_PLAYER_GREY 0x8B8B8BDD
#define COLOR_PLAYER_DARKGREY 0x656565DD
#define COLOR_PLAYER_WHITE 0xFFFFFFDD
#define COLOR_PLAYER_BLACK 0x000000DD
#define COLOR_PLAYER_AQUAMARINE 0x7FFFD4DD
#define COLOR_PLAYER_CYAN 0x00FFFFDD
#define COLOR_GM_REG 0xFFFFFFAA		// WHITE (FFFFFF) normal chat to everyone (registered users)
#define COLOR_GM_UNREG 0xFF9999AA	// LIGHT RED(FF9999) normal chat to everyone (unregistered users)
#define COLOR_GM_ADMIN 0xFFCC66AA	// LIGHT ORANGE (FFCC66) normal chat to everyone (admins)
#define COLOR_IRC 0x66CCFFAA		// LIGHT BLUE (66CCFF) irc messages (/me /query (!) /slap)
#define COLOR_ADMINCHAT 0xFF9933AA	// BRIGHT ORANGE (FF9933) admin only chat (@)
#define COLOR_SYSTEM_PM 0x66CC00AA	// LIGHT GREEN (66CC00) system generated personal message (logged in, progress saved, function disabled)
#define COLOR_SYSTEM_GM 0xFF9966AA	// LIGHT ORANGE-RED (FF9966) system generated general message ("x just bought the four dragons!")
#define COLOR_SYSTEM_PW 0xFFFF33AA	// YELLOW (FFFF33) system personal warning ("you must be in a bank")
#define COLOR_SYSTEM_GW 0xCCCCCCAA	// GRAY (CCCCCC) system general warning ("x used a money cheat")
#define COLOR_MONEY_INC 0x00CC66AA	// GREEN (00CC66) money increase related system message ("you earned x money")
#define COLOR_MONEY_DEC 0xFF6600AA	// RED (FF6600) money decrease related system message ("your property has been bought out")
#define COLOR_MENU 0xFFFFFFAA		// WHITE (FFFFFF) menu's (/help)
#define COLOR_CMD 0xFFFFFFAA		// WHITE (FFFFFF)commands (Usage: ...)
#define COLOR_ADMIN_CMD 0xCC6666AA	// RED BROWN (CC6666) admin commands (Usage: ...)
#define COLOR_ADMIN_PM 0x6699CCAA	// GREEN BLUE (6699CC) admin personal message (your money has been set to X)
#define COLOR_ADMIN_PW 0x99CCFFAA	// BLUE (99CCFF) admin personal warning (x is not an active player)
#define COLOR_ADMIN_GM 0xFF6633AA	// LIGHT RED (FF6633) admin general message (was jailed by admin x)
#define COLOR_STATS 0xCCCCFFAA		// LIGHT  PURPLE (CCCCFF) stats (/stat /totalstat)
#define COLOR_MESSAGE 0xFFCCFFAA	// PURPLE (FFCCFF) Message system (anticheat, blog address)
#define COLOR_RULES 0xDC143CAA      // RED
#define COLOR_ADMIN_TOALL 0x00FFFFAA// CYAN
#define COLOR_GROUPTALK 0x87CEEBAA  // SKYBLUE
#define COLOR_ADMIN_REPORT 0xFF69B4AA // HOTPINK
#define COLOR_ADMIN_SPYREPORT 0xB0E0E6AA //POWDERBLUE
#define COLOR_ADMIN 0xFF8200FF
#define COLOR_CARDIVE 0xEE82EEAA //VIOLET
#define COLOR_BLACK_PD 0x000000FF
#define COLOR_WHITE_PD 0xFFFFFFFF
#define COLOR_DISARMING 0xEE82EEBB
So yea.... Join pl0x and try it...

/el = Create elevator
/mel x y z = Move the elevator you made to the xyz co-ords
/rele = remove elevator...


ONLY COMPATIBLE WITH 0.3c!!!

Enjoy!

Ps, you will have to change
Код:
#DEFINE MAX_PLAYERS 20
to the amount of slots your server has..

The update adds the speed controll!
Reply
#2

fail bug xD.Im test in ur server
Reply
#3

Quote:
Originally Posted by venice
Посмотреть сообщение
fail bug xD.Im test in ur server
Not a bug, sa-mp flaw If you touch a object as the ele is moving you can fall out... D: i got a new one on if you wana come check it out
Reply
#4

Man very nice u did it but that's currently bugged so maybe u made that for old version or just bug's try fix that please.
Reply
#5

Fail, not working, I just fall
Reply
#6

can i use this on 3e
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)