Please Help! How Can I Add One More Class? Please Help!
#1

Ok, I Just Got This Game Mode Script From My Friend And I Need Some Help,
I Want To Add Like 3 More People (Skins) To Each Class, Can Someone Please Make Me
The New Code? Or Explain How I Would Do That? I Would Be Very Thankful!!


Код:
#include <a_samp>

#pragma tabsize 0


#define WHITE_COLOR 0xFFFFFFAA // white
#define BLUE_COLOR 0x0000BBAA // blue
#define COLOR_RED 0xAA3333AA //red


forward GameModeExitFunc();
forward Restart();


forward OVER();


#define TEAM_1 0
#define TEAM_2 1
#define TEAM_3 2


new Team[MAX_PLAYERS];


new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Protect The President By Dustin");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Protect The President By Dustin");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Play Classes And Vehicles Below:
	SetGameModeText("Protect The President v1.0");



	//-------5 minutes-----------
	SetTimer("ROUND OVER!", 300000, 0);



	AddPlayerClass(122,-2168.0637,288.5149,35.3203,66.4466,31,500,27,500,0,0); // Terorist

	AddPlayerClass(164,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500,0,0); // Bodyguard
	AddPlayerClass(165,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500,0,0); // President

	  // Below Are Terorit's Spawn Location Vehicles
	AddStaticVehicle(474,-2170.9539,293.5864,34.8803,0.2331,26,89); // T CAR
	AddStaticVehicle(474,-2176.2070,293.0461,34.8814,0.8276,45,102); // T CAR
	AddStaticVehicle(474,-2180.5542,293.2364,34.8794,3.0973,35,35); // T CAR
	AddStaticVehicle(474,-2184.1550,293.4302,34.8800,359.9232,65,1); // T CAR
	AddStaticVehicle(474,-2188.5264,293.9099,34.8799,359.9416,65,1); // T CAR
	AddStaticVehicle(474,-2192.9963,293.6054,34.8800,359.7897,65,1); // T CAR
	 // Below Are Prez And Police Spawn Location Vehicles
	AddStaticVehicle(597,-2401.7358,346.1073,34.7363,226.6862,0,1); // SFPD CAR
	AddStaticVehicle(597,-2388.4863,349.0449,34.7523,335.1724,0,1); // SFPD CAR



  Textdraw0 = TextDrawCreate(248.000000,431.000000,"PTP v1.0 By Dustin");
	TextDrawAlignment(Textdraw0,0);
	TextDrawBackgroundColor(Textdraw0,0x000000ff);
	TextDrawFont(Textdraw0,0);
	TextDrawLetterSize(Textdraw0,1.000000,1.500000);
	TextDrawColor(Textdraw0,0xffffffff);
	TextDrawSetProportional(Textdraw0,1);
	TextDrawSetShadow(Textdraw0,2);

	Textdraw2 = TextDrawCreate(1.000000,1.000000,"..");
	TextDrawUseBox(Textdraw2,1);
	TextDrawBoxColor(Textdraw2,0x000000ff);
	TextDrawTextSize(Textdraw2,690.000000,435.000000);
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x000000ff);
	TextDrawFont(Textdraw2,3);
	TextDrawLetterSize(Textdraw2,1.000000,12.600009);
	TextDrawColor(Textdraw2,0x000000ff);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);


	Textdraw1 = TextDrawCreate(1.000000,426.000000,"..");
	TextDrawUseBox(Textdraw1,1);
	TextDrawBoxColor(Textdraw1,0x000000ff);
	TextDrawTextSize(Textdraw1,674.000000,0.000000);
	TextDrawAlignment(Textdraw1,0);
	TextDrawBackgroundColor(Textdraw1,0x000000ff);
	TextDrawFont(Textdraw1,3);
	TextDrawLetterSize(Textdraw1,1.000000,2.200000);
	TextDrawColor(Textdraw1,0x000000ff);
	TextDrawSetOutline(Textdraw1,1);
	TextDrawSetProportional(Textdraw1,1);
	TextDrawSetShadow(Textdraw1,1);


	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerCameraPos(playerid, 1647.6301,-1134.5725,58.2489);
	SetPlayerCameraLookAt(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerFacingAngle(playerid,258.5584);

 	if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
//---------------------WELCOME MESSAGE-----------------------------
	SendClientMessage(playerid,BLUE_COLOR, "____________________ WELCOME TO PROTECT THE PRESIDENT V1.0 BY DUSTIN! ____________________");
	SendClientMessage(playerid,WHITE_COLOR, "|Duty: President = Stay Alive Untill Round Ends | Terorist: Kill The President | Bodyguard: Protect The President|");
	SendClientMessage(playerid,WHITE_COLOR, "Team Killing And Spawn Killing Is NOT Allowed! Hacking And Cheating Is Also Not Allowed! ");
	SendClientMessage(playerid,WHITE_COLOR, "Doing So Will Result In Being Kicked From The Server Or If Done Muliple Times, You Will Be Banned!");

	GameTextForPlayer(playerid, " ~r~ Welcome To Protect The President v1.0", 2500 , 0);

	TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(Team[playerid] == TEAM_1)
	{
		SetPlayerColor(playerid, WHITE_COLOR);
	}
	else if(Team[playerid] == TEAM_2)
	{
		SetPlayerColor(playerid, BLUE_COLOR);
	}

	SendClientMessage(playerid,BLUE_COLOR," The President Has Spawned! 5 Minutes Left Before The Round Is Over!");

	TextDrawHideForPlayer(playerid, Textdraw1);
	TextDrawHideForPlayer(playerid, Textdraw2);


	return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
  SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
	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[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		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)
{
	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)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
public OVER()
{
	GameTextForAll("~r~ Round Over! ~b~ The President Was Killed By The Terorists!", 2500 , 0);
	SetTimer("Restart", 10000 , 0);
}
public GameModeExitFunc()
{
	GameModeExit();
}
public Restart()
{
	GameTextForAll("~g~ The President Is ~b~ Safe!", 2500, 0);
	SendRconCommand("gmx");
}
Reply
#2

https://sampwiki.blast.hk/wiki/AddPlayerClass
Reply
#3

Quote:
Originally Posted by Compton's Eazy E (Eazyrp.tk)
I have done that, but when I enter my server, the classes are all messed up cuz I have them labeled so when you use
the arrow keys, it tells you what class they are, and the colors are messed up cuz it has that textdraw bullshit!
Reply
#4

im not really understanding but, Is this what you mean?


since there is 3 Classes:

AddPlayerClass(122,-2168.0637,288.5149,35.3203,66.4466,31,500,27,500,0 ,0); // Terorist
AddPlayerClass(164,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // Bodyguard
AddPlayerClass(165,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // President

You Need to edit
Код:
if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
So if you add another AddPlayerClass and if you want the person to be a BodyGuard replace

else if(classid == 1)

with

else if(classid == 1, 3)

Since there are 4 classes, Get it?
Reply
#5

Quote:
Originally Posted by Compton's Eazy E (Eazyrp.tk)
im not really understanding but, Is this what you mean?


since there is 3 Classes:

AddPlayerClass(122,-2168.0637,288.5149,35.3203,66.4466,31,500,27,500,0 ,0); // Terorist
AddPlayerClass(164,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // Bodyguard
AddPlayerClass(165,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // President

You Need to edit
Код:
if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
So if you add another AddPlayerClass and if you want the person to be a BodyGuard replace

else if(classid == 1)

with

else if(classid == 1, 3)

Since there are 4 classes, Get it?
XD, Not Really, I Will Try It Anyway Since I Have Made A Backup File, Thanks For Your Help.
Reply
#6

Quote:
Originally Posted by Compton's Eazy E (Eazyrp.tk)
im not really understanding but, Is this what you mean?


since there is 3 Classes:

AddPlayerClass(122,-2168.0637,288.5149,35.3203,66.4466,31,500,27,500,0 ,0); // Terorist
AddPlayerClass(164,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // Bodyguard
AddPlayerClass(165,-2429.3110,323.7393,35.1719,296.9317,31,500,27,500, 0,0); // President

You Need to edit
Код:
if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
So if you add another AddPlayerClass and if you want the person to be a BodyGuard replace

else if(classid == 1)

with

else if(classid == 1, 3)

Since there are 4 classes, Get it?
Ok, I did it, it gave me a warning when I compiled, and will they still be on the same team?
Sorry, I dont know that much about scripting
Reply
#7

yeah they will, Whats the warning?
Reply
#8

Quote:
Originally Posted by Compton's Eazy E (Eazyrp.tk)
yeah they will, Whats the warning?
Warning Says "warning 206 redunt test expression is non-zero"

AND ONE MORE THING! I ENTERED MY SERVER, THE TERORIST SAYS TERORIST, BUT THE BODYGUARDS AND THE PRESIDENT, THE PREZ! SAY BOTH THAT THEY ARE BODYGUARD! (WHEN I USE ARROW KEY TO GO ON IT, IT SAYS THE PRESIDENT IS A BODYGUARD!)
Reply
#9

IDK if this can help with the warning but try putting:

Код:
if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1, 3)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
Under OnPLayerRequestSpawn
Reply
#10

Quote:
Originally Posted by Compton's Eazy E (Eazyrp.tk)
IDK if this can help with the warning but try putting:

Код:
if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terrorist", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1, 3)
	{
		GameTextForPlayer(playerid, "~b~ Bodyguard", 9000, 3);
		Team[playerid] = TEAM_2;
	}
	else if(classid == 2)
	{

	  GameTextForPlayer(playerid, "~b~ President", 9000, 3);
	  Team{playerid} = TEAM_3;
	 }
Under OnPLayerRequestSpawn
Yes, But What Do I Do With The President? When You Look At Him On The Player Class Selection, Its Says On The Screen Hes A Bodyguard
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)