#include < a_samp >
#define SOLDIER 1
#define SNIPER 2
#define ENGINEER 3
#define JETTROOPER 4
#define PILOT 5
#define SPY 6
new gPlayerClass[MAX_PLAYERS];// for defining classes
new PickedClass[MAX_PLAYERS];// this variable can be used in many functions
#define COLOR_WHITE 0xFFFFFFFF
#define COL_GREEN "{6EF83C}"
#define COL_WHITE "{FFFFFF}"
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x33AA33AA
public OnPlayerRequestSpawn(playerid)
{
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Soldier Class\nSniper Class\nEngineer Class\nJet-Trooper Class\nPilot Class\nSpy Class", "Choose","");//this is the class dialog, you can change it if you want but dont forget to define the class also
return 1;
}
public OnPlayerSpawn(playerid)
{
if(gPlayerClass[playerid] == SOLDIER)//This is for the First soldier class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 31, 200);//m4
GivePlayerWeapon(playerid, 25, 100);//mp5
GivePlayerWeapon(playerid, 24, 70);//deagle
}
else if(gPlayerClass[playerid] == SNIPER)//This is for the Second Sniper class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 34, 250);//sniper
GivePlayerWeapon(playerid, 29, 250);//mp5
GivePlayerWeapon(playerid, 4, 1);//knife
}
else if(gPlayerClass[playerid] == ENGINEER)//This is for the Second Engineer class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 27, 200);//spas12
GivePlayerWeapon(playerid, 23, 200);//silent pistol
GivePlayerWeapon(playerid, 35, 2);//rpg
GivePlayerWeapon(playerid, 16, 2);//grenade
}
else if(gPlayerClass[playerid] == JETROOPER)//This is for the Second Jetrooper class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 32, 500);//tec-9
GivePlayerWeapon(playerid, 22, 500);//colt
GivePlayerWeapon(playerid, 4, 1);//knife
}
else if(gPlayerClass[playerid] == PILOT)//This is for the Second Pilot class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 200);//deagle
GivePlayerWeapon(playerid, 17, 4);//moltove
GivePlayerWeapon(playerid, 25, 100);//shotgun
}
else if(gPlayerClass[playerid] == SPY)//This is for the Second Spy class.
{
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 29, 200);//mp5
GivePlayerWeapon(playerid, 23, 200);//silent pistol
GivePlayerWeapon(playerid, 4, 1);//knife
GivePlayerWeapon(playerid, 18, 2);//moltove
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/jetpack", true))//jetpack spawn command
{
if(gPlayerClass[playerid] == JETTROOPER)//if the player is jettrooper
{
SetPlayerSpecialAction(playerid,2);//This is command for the jet trooper, he can spawn jetpack by /jp command
return 1;
}
}
if(!strcmp(cmdtext, "/dis", true))//dialog which tells u about the spy class disguises
{
if(gPlayerClass[playerid] == SPY)
{
ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy Disguise Kit:", "/team1\n/team2\n/team3", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
return 1;
}
}
if(!strcmp(cmdtext, "/team1", true))//This is for disguise to team 1
{
if(gPlayerClass[playerid] == SPY)//if player class spy
{
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team1:", "Team: Team1\nColor: Red\nSkin: 285\nDisguised Class: Soldier", "Ok ","");
SetPlayerSkin(playerid,285);//skin set to S.W.A.T, can change to ur team skin
SetPlayerColor(playerid,COLOR_RED)//Color Red
return 1;
}
}
if(!strcmp(cmdtext, "/team2", true))//This is for disguise to team 2
{
if(gPlayerClass[playerid] == SPY)//if player class spy
{
ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team2:", "Team: Team2\nColor: White\nSkin: 287\nDisguised Class: Soldier", "Ok ","");
SetPlayerSkin(playerid,287);//skin set to Military, can change to ur team skin
SetPlayerColor(playerid,COL_WHITE)//Color white
return 1;
}
}
if(!strcmp(cmdtext, "/team3", true))//This is for disguise to team 1
{
if(gPlayerClass[playerid] == SPY)//if player class spy
{
ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team3:", "Team: Team3\nColor: Green\nSkin: 181\nDisguised Class: Soldier", "Ok ","");
SetPlayerSkin(playerid,181);//skin set to Rockstar, can change to ur team skin
SetPlayerColor(playerid,COLOR_GREEN)//Color green
return 1;
}
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);//variable to get vehicle ids
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");//messages goes to the player that he can't drive the hunter
RemovePlayerFromVehicle(playerid);//get u off from the hunter
}
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hydra");//messages goes to the player that he can't drive the hydra
RemovePlayerFromVehicle(playerid);//get u off from the hydra
}
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == PILOT && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is Soldier then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Soldier to drive Tank");//messages goes to the player that he can't drive the tank or rhino
RemovePlayerFromVehicle(playerid);//get u off from the tank or rhino
}
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETTROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Sea Sparrow");/messages goes to the player that he can't drive the tank or sea sparrow
RemovePlayerFromVehicle(playerid);//get u off from the sea sparrow
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 999)//dialog id response
{
if(response)
{
if(listitem == 0)//the listitem0, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Soldier as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Soldier Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, good in infantry attacks.\n\n{F81414}Weapons:\n\n{FFFFFF}M4\n{FFFFFF}Shotgun\n{FFFFFF}Deagle", "Play","");
gPlayerClass[playerid] = SOLDIER;//setting the class to soldier
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 31, 200);//m4
GivePlayerWeapon(playerid, 25, 100);//mp5
GivePlayerWeapon(playerid, 24, 70);//deagle
}
}
if(listitem == 1)//the listitem1, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Sniper as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Sniper Class:", "{F81414}Abilities:\n{FFFFFF}A Locater class, Always invisible on map.\n\n{F81414}Weapons:\n\n{FFFFFF}Sniper Rifle\n{FFFFFF}Mp5\n{FFFFFF}Knife", "Play","");
gPlayerClass[playerid] = SNIPER;//setting the class to Sniper
PickedClass[playerid] = 1;
RemovePlayerMapIcon(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 34, 250);//sniper
GivePlayerWeapon(playerid, 29, 250);//mp5
GivePlayerWeapon(playerid, 4, 1);//knife
}
}
if(listitem == 2)//the listitem2, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Engineer as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Engineer Class:", "{F81414}Abilities:\n{FFFFFF}A Strong class, Good in both land and air\nCan drive tanks.\n\n{F81414}Weapons:\n\n{FFFFFF}Spas12\n{FFFFFF}Silent Pistol\n{FFFFFF}RPG\n{FFFFFF}Grenade", "Play","");
gPlayerClass[playerid] = ENGINEER;//setting the class to engineer
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 27, 200);//spas12
GivePlayerWeapon(playerid, 23, 200);//silent pistol
GivePlayerWeapon(playerid, 35, 2);//rpg
GivePlayerWeapon(playerid, 16, 2);//grenade
}
}
if(listitem == 3)//the listitem3, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Jetrooper as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Jetrooper Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, cna spawn jetpack by /jetpack.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife", "Play","");
gPlayerClass[playerid] = JETTROOPER;//setting the class to jettrooper
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 32, 500);//tec-9
GivePlayerWeapon(playerid, 22, 500);//colt
GivePlayerWeapon(playerid, 4, 1);//knife
}
}
if(listitem == 4)//the listitem4, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Pilot as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Pilot Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Can drive hunter, hydra & sea sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun", "Play","");
gPlayerClass[playerid] = PILOT;//setting the class to pilot
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 200);//deagle
GivePlayerWeapon(playerid, 17, 4);//moltove
GivePlayerWeapon(playerid, 25, 100);//shotgun
}
}
if(listitem == 5)//the listitem5, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Spy as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy Class:", "{F81414}Abilities:\n{FFFFFF}A Victim class, Can Disguise to enemy assaults by /dis\n\n{F81414}Weapons:\n\n{FFFFFF}Mp5\n{FFFFFF}Silent Pistol\n{FFFFFF}Knife\n{FFFFFF}Moltove", "Play","");
gPlayerClass[playerid] = SPY;//setting the class to Spy
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 29, 200);//mp5
GivePlayerWeapon(playerid, 23, 200);//silent pistol
GivePlayerWeapon(playerid, 4, 1);//knife
GivePlayerWeapon(playerid, 18, 2);//moltove
}
}
return 1;
}
return 1;
}
return true;
}
new vehicleid = GetPlayerVehicleID(playerid);//variable to get vehicle ids
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == PILOT)//if player is pilot
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");//messages goes to the player that he can't drive the hunter
RemovePlayerFromVehicle(playerid);//get u off from the hunter
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:PosX,Float:PosY,Float:PosZ,model = GetVehicleModel(vehicleid);
if(model == 425)//Hunter
{
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == ASSAULT)
{//then
GetPlayerPos(playerid,PosX,PosY,PosZ);//getting player pos
SetPlayerPos(playerid,PosX,PosY,PosZ);//setting player to same pos to avoid entering vehicle
SendClientMessage(playerid, 0xAA3333AA, "ERROR: You Need to be Pilot to Fly Hunter!");
}
}
if(model == 425)//Hunter
{
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SNIPER)
{//then
GetPlayerPos(playerid,PosX,PosY,PosZ);//getting player pos
SetPlayerPos(playerid,PosX,PosY,PosZ);//setting player to same pos to avoid entering vehicle
SendClientMessage(playerid, 0xAA3333AA, "ERROR: You Need to be Pilot to Fly Hunter!");
}
}
if(model == 425)//Hunter
{
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == ENGINEER)
{//then
GetPlayerPos(playerid,PosX,PosY,PosZ);//getting player pos
SetPlayerPos(playerid,PosX,PosY,PosZ);//setting player to same pos to avoid entering vehicle
SendClientMessage(playerid, 0xAA3333AA, "ERROR: You Need to be Pilot to Fly Hunter!");
}
}
if(model == 425)//Hunter
{
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == JETTROOPER)
{//then
GetPlayerPos(playerid,PosX,PosY,PosZ);//getting player pos
SetPlayerPos(playerid,PosX,PosY,PosZ);//setting player to same pos to avoid entering vehicle
SendClientMessage(playerid, 0xAA3333AA, "ERROR: You Need to be Pilot to Fly Hunter!");
}
}
return 1;
}
In$$ane there is something is not valid...
pawn Code:
This should be this: pawn Code:
==> And one more thing i am not understanding your spy system..... Can u tell it clearly? |
enum { Soldier, Sniper, Engineer, JetTrooper, Pilot, Spy };
enum PlayerInfo { Team };
new Info[MAX_PLAYERS][PlayerInfo];
//So instead of #define a hundred times, a simple enum..and an info array instead of a gPlayerClass array.
//This way they can put Kills etc into that single array instead of making a new one.
if(!strcmp(cmdtext, "/jetpack", true))
{
if(Info[playerid][Team] != JetTrooper) return SendClientMessage(playerid, 0xCC0000AA, "You aren't a Jet Trooper!");
SetPlayerSpecialAction(playerid,2);
return 1;
}
//or
CMD:jetpack(playerid, params[])
{
if(Info[playerid][Team] != JetTrooper) return SendClientMessage(playerid, 0xCC0000AA, "You aren't a Jet Trooper!");
SetPlayerSpecialAction(playerid,2);
return 1;
}
//That's an example on what I mean by a different array
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");//messages goes to the player that he can't drive the hunter
RemovePlayerFromVehicle(playerid);//get u off from the hunter
}
//can be
if(Info[playerid][Team] != Pilot && GetVehicleModel(vehicleid) == 425)
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");
RemovePlayerFromVehicle(playerid);
}
if(something) //if this isn't found THEN
else if(somethingelse) //we check this, if it isn't found
else if(somethingelseagain) //we check this
else //if nothing is found above, we do this
if(something) //ok we found this
if(somethingelse) //we found this too, so we run it
if(blahblah) //we found this so we're still gonna do it
In$$ane there is something is not valid...
pawn Code:
This should be this: pawn Code:
==> And one more thing i am not understanding your spy system..... Can u tell it clearly? |
GetPlayerPos(playerid,PosX,PosY,PosZ);
SetPlayerPos(playerid,PosX,PosY,PosZ);
ClearAnimations(playerid);
if(gPlayerClass[playerid] == WHATEVER_CLASS_OTHER_THAN_PILOT return SendClientMessage(playerid, RED, "You need to be a pilot to enter this vehicle! ");