rendered paste body#include <a_samp>
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA
#define COLOR_ORANGE 0xFF9900AA
#define TEAM_RED 0
#define TEAM_ORANGE 1
static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player
new gPlayerClass[MAX_PLAYERS];
new Menu:VMain;
new Menu:WMain;
new gPlayerGotFlag;
forward SetupPlayerForClassSelection(playerid);
forward Time();
forward Exit();
forward PlayerGotFlag(playerid);
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" CtF LV by [AC]FrozenX");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
SetTimer("Exit",1200000,0);
SetTimer("Time", 600000, 1);
// Don't use these lines if it's a filterscript
SetGameModeText("CtF LV");
AddPlayerClass(60,2844.5024,1291.6553,11.3906,106.1010,0,0,0,0,0,0);
AddPlayerClass(101,1035.8816,1840.3611,11.4683,98.5249,0,0,0,0,0,0);
AddStaticVehicle(522,2834.9280,1311.5413,10.3497,179.5828,6,25); //
AddStaticVehicle(529,2834.2874,1282.7986,10.4107,184.7345,42,42); //
AddStaticVehicle(541,2833.8850,1268.1299,10.4028,179.0264,58,8); //
AddStaticVehicle(541,2833.7871,1324.1587,10.4027,354.4240,58,8); //
AddStaticVehicle(541,1020.9497,1833.3663,10.4452,81.4285,58,8); //
AddStaticVehicle(522,1025.4763,1833.3470,10.3852,91.4181,8,82); //
AddStaticVehicle(529,1039.2119,1834.4541,10.4511,266.2548,62,62); //
AddStaticVehicle(522,1033.5278,1832.0598,10.3865,272.1257,36,105); //
AddStaticPickup(360,19,1972.8921,1623.4976,12.4314);
return 1;
}
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 90.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1003.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerClass(playerid, classid);
SetupPlayerForClassSelection(playerid);
gPlayerClass[playerid] = classid;
switch (classid) {
case 0:
{
GameTextForPlayer(playerid, "~r~RED Team", 500, 3);
}
case 1:
{
GameTextForPlayer(playerid, "ORANGE Team", 500, 3);
}
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_RED,"Welcome by CtF LV");
SendClientMessage(playerid,COLOR_RED,"Made by [AC]FrozenX");
SendClientMessage(playerid,COLOR_RED,"Typ /help when you need Help!");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
if(gTeam[playerid] == TEAM_RED) {
SetPlayerColor(playerid,COLOR_RED); // Green
}
else if(gTeam[playerid] == TEAM_ORANGE) {
SetPlayerColor(playerid,COLOR_ORANGE); // Red
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
DisablePlayerCheckpoint(playerid);
if(killerid == INVALID_PLAYER_ID) {
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
} else {
if(gTeam[killerid] != gTeam[playerid]) {
// Valid kill
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 1000);
}
else {
//Team Killer!
new warning[256];
format(warning, sizeof(warning), "Be careful! You have been punished for teamkilling.");
SendClientMessage(killerid, 0xFFFF00AA, warning);
SendDeathMessage(killerid,playerid,reason);
GivePlayerMoney(killerid, -1000);
SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
}
if(gPlayerGotFlag == 1);
{
AddStaticPickup(360,19,2183.6887,1110.9854,12.2135);
}
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[255];
cmd = strtok(cmdtext, idx );
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
if(gPlayerGotFlag == 1){
SetPlayerScore(playerid, -1);
DisablePlayerCheckpoint(playerid);
SetPlayerHealth(playerid,0);
AddStaticPickup(360,19,2183.6887,1110.9854,12.2135);}
else {
SetPlayerScore(playerid, -1);
DisablePlayerCheckpoint(playerid);
SetPlayerHealth(playerid,0);}
return 1;
}
if (strcmp("/scoreadd",cmdtext, true ,10)==0)
{
SetPlayerScore(playerid, 10);
SendClientMessage(playerid,COLOR_RED,"You got 10 points!");
return 1;
}
if(strcmp(cmdtext,"/not ",true,4)==0 && IsPlayerAdmin(playerid)==1)
{
new output[255];
strmid(output,cmdtext,4,strlen(cmdtext));
GameTextForAll(output,4000,3);
return 1;
}
if(strcmp(cmdtext,"/Weapons",true,4)==0 && IsPlayerAdmin(playerid)==1)
{
GivePlayerWeapon(playerid,23,50000);
return 1;
}
if(strcmp(cmdtext, "/Wmenu",true)==0){
WMain = CreateMenu(" ",1,100,200,90,25);
AddMenuItem(WMain,0,"Colt 45");
AddMenuItem(WMain,0,"Desert Eagle");
AddMenuItem(WMain,0,"Uzi");
AddMenuItem(WMain,0,"AK-47");
AddMenuItem(WMain,0,"MP5");
AddMenuItem(WMain,0,"Sawn-Off Shotgun");
AddMenuItem(WMain,0,"Grenade");
AddMenuItem(WMain,0,"Baseball Bat");
AddMenuItem(WMain,0,"TEC-9");
AddMenuItem(WMain,0,"Special One!");
ShowMenuForPlayer(WMain,playerid);
return 1;
}
if(strcmp(cmdtext, "/Carmenu", true) == 0) {
VMain = CreateMenu(" ",1,100,200,90,25);
AddMenuItem(VMain,0,"NRG");
AddMenuItem(VMain,0,"Elegy");
AddMenuItem(VMain,0,"Turismo");
AddMenuItem(VMain,0,"Super GT");
AddMenuItem(VMain,0,"Phoenix");
AddMenuItem(VMain,0,"Banshee");
AddMenuItem(VMain,0,"Sultan");
AddMenuItem(VMain,0,"Sabre");
AddMenuItem(VMain,0,"Clover");
AddMenuItem(VMain,0,"Lowrider");
ShowMenuForPlayer(VMain,playerid);
return 1;
}
if(strcmp(cmdtext, "/CarDealers", true)==0)
{
SetPlayerPos(playerid,2080.01,1683.779,10.56309);
SetPlayerFacingAngle(playerid,270.0);
}
if(strcmp(cmd, "/create", true) == 0 ){
if(IsPlayerAdmin(playerid) == 1){
new tmp[256];
new objid;
new rot;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/create [objid] [rot]");
return 1;
}
objid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/create [objid] [rot]");
return 1;
}
new Float:X, Float:Y,Float:Z,Float:rX,Float:rY;
GetPlayerPos(playerid, X, Y, Z);
rot = strval(tmp);
SetPlayerPos(playerid,X,Y,Z +5);
CreateObject(objid, X, Y, Z, rX, rY, rot);
}
return 1;
}
if(strcmp(cmdtext, "/afk", true) == 0)
{
new string[255];
SendClientMessage(playerid,0x33CCCC,"You Declare your Away From Keyboard Status");
SendClientMessage(playerid,COLOR_RED,"You are now FREEZED ");
SendClientMessage(playerid,COLOR_RED,"type /back when u are back over your Keyboard.");
SendClientMessage(playerid,COLOR_RED,"and u will be UN-FREEZED .");
TogglePlayerControllable (playerid, 0);
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof(string),"%s is AWAY FROM KEYBOARD AND FREEZED HIMSELF .", string);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
//BACK Command
if(strcmp(cmdtext, "/back", true) == 0)
{
new string[255];
SendClientMessage(playerid,0x33CCCC,"You Declare your are back over your Keyboard");
SendClientMessage(playerid,COLOR_RED,"You are now UN - FREEZED ");
TogglePlayerControllable (playerid, 1);
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof(string),"%s is BACK OVER THE KEYBOARD AND IS NOW UN-FREEZED .", string);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
if(strcmp(cmdtext,"/Help", true)==0)
{
SendClientMessage(playerid,COLOR_RED,"This is the help message for CtF LV!");
SendClientMessage(playerid,COLOR_RED,"You need to find the flag and bring him to your spawn. Then your team will win!");
SendClientMessage(playerid,COLOR_RED,"Use /commands to see all commands. If you are Admin use /acommands to see the commands for Admins!");
return 1;
}
if(strcmp(cmdtext,"/commands",true)==0)
{
SendClientMessage(playerid,COLOR_RED,"Handy commands: /afk and /back.");
SendClientMessage(playerid,COLOR_RED,"Menu commands: /Wmenu and /Carmenu.");
SendClientMessage(playerid,COLOR_RED,"To get your car from the menu: /CarDealers.");
SendClientMessage(playerid,COLOR_RED,"If you are admin:/acommands. Help command is: /Help and you got also /kill.");
return 1;
}
if(strcmp(cmdtext,"acommands",true)==0) {
if(IsPlayerAdmin(playerid)== 1){
SendClientMessage(playerid,COLOR_RED,"/not: to announce something.");
SendClientMessage(playerid,COLOR_RED,"/Weapons:To get a Colt 45 with 50000 Ammo.");
SendClientMessage(playerid,COLOR_RED,"/Create: To create objects.");
}
return 1;
}
return 0;
}
public OnPlayerInfoChange(playerid)
{
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
GetPlayerTeam(playerid);
if (gTeam[playerid]==TEAM_RED) {
GameTextForAll("Team Red Wins!",1000,3);
GameModeExit();
}
else if
GameTextForAll("Team Orange Wins!",1000,3)*then
GameModeExit();
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
GetPlayerTeam(playerid);
if (gTeam[playerid] == TEAM_RED){
GameTextForAll("Team RED got the Flag!",1000,3);
SetPlayerCheckpoint(playerid,2844.5024,1291.6553,11.3906,6);
}
else{
GameTextForAll("Team Orange got the Flag!",1000,3);
SetPlayerCheckpoint(playerid,1035.8816,1840.3611,11.4683,6);
}
{
gPlayerGotFlag == 1;
}
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
SetPlayerClass(playerid, classid) {
if(classid == 0) {
gTeam[playerid] = TEAM_RED;
} else if(classid == 1) {
gTeam[playerid] = TEAM_ORANGE;
}
}
public Exit()
{
GameModeExit();
}
public Time()
{
new sText[255];
format(sText,sizeof(sText),"Rules: Don't Cheat, don't shit and Listen to admins!",GetTickCount());
print(sText);
SendClientMessageToAll(0xFF0000, sText);
}
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:Current = GetPlayerMenu(playerid);
if (Current == VMain) {
switch(row) {
case 0: {CreateVehicle(522,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 1: {CreateVehicle(562,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 2: {CreateVehicle(451,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 3: {CreateVehicle(506,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 4: {CreateVehicle(603,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 5: {CreateVehicle(429,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 6: {CreateVehicle(560,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 7: {CreateVehicle(475,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 8: {CreateVehicle(542,2084.01,1683.779,10.56309,60,-1,-1,10000);}
case 9: {CreateVehicle(567,2084.01,1683.779,10.56309,60,-1,-1,10000);}
}
}
if (Current == WMain ) {
switch(row) {
case 0: {GivePlayerWeapon(playerid,23,500);}
case 1: {GivePlayerWeapon(playerid,24,500);}
case 2: {GivePlayerWeapon(playerid,28,500);}
case 3: {GivePlayerWeapon(playerid,30,500);}
case 4: {GivePlayerWeapon(playerid,29,500);}
case 5: {GivePlayerWeapon(playerid,26,500);}
case 6: {GivePlayerWeapon(playerid,16,500);}
case 7: {GivePlayerWeapon(playerid,5,500);}
case 8: {GivePlayerWeapon(playerid,32,500);}
case 9: {GivePlayerWeapon(playerid,12,500);}
}}
return 1;
}
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 PlayerGotFlag(playerid)
{
new string[255];
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof(string),"%s got the flag, kill him!", string);
SendClientMessageToAll(0xFFFFFFAA,string);
}