pawn Код:
// ================================================================================================ //
// //
// ** RANK SYSTEM ** //
// //
// ================================================================================================ //
new Text:Private;
new Text:Corporal;
new Text:Seargeant;
new Text:Lieutenant;
new Text:Captain;
new Text:General;
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 520)
{
if(GetRank(playerid) == 2){
}
else
{
RemovePlayerFromVehicle(playerid);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_RED, "This vehicle is just allowed for the rank 2!");
}
}
return 1;
}
Ranks__init()
{
print("\n--------------------------------------");
print("[FS] Rank System v.1 Loaded Succesfully !!");
print("--------------------------------------\n");
Private = TextDrawCreate(500, 100, "Rank: Private");
TextDrawAlignment(Private, 1);
TextDrawFont(Private, 2);
TextDrawLetterSize(Private, 0.400, 1.000);
TextDrawColor(Private, COLOR_WHITE);
TextDrawSetOutline(Private, 1);
Corporal = TextDrawCreate(486, 100, "Rank: Corporal'");
TextDrawAlignment(Corporal, 1);
TextDrawFont(Corporal, 2);
TextDrawLetterSize(Corporal, 0.400, 1.000);
TextDrawColor(Corporal, COLOR_YELLOW);
TextDrawSetOutline(Corporal, 1);
Seargeant = TextDrawCreate(500, 100, "Rank: Seargeant");
TextDrawAlignment(Seargeant, 1);
TextDrawFont(Seargeant, 2);
TextDrawLetterSize(Seargeant, 0.400, 1.000);
TextDrawColor(Seargeant, COLOR_GREEN);
TextDrawSetOutline(Seargeant, 1);
Lieutenant = TextDrawCreate(500, 100, "Rank: Lieutenant'");
TextDrawAlignment(Lieutenant, 1);
TextDrawFont(Lieutenant, 2);
TextDrawLetterSize(Lieutenant, 0.400, 1.000);
TextDrawColor(Lieutenant, COLOR_ROYAL);
TextDrawSetOutline(Lieutenant, 1);
Captain = TextDrawCreate(483, 100, "Rank: Captain");
TextDrawAlignment(Captain, 1);
TextDrawFont(Captain, 2);
TextDrawLetterSize(Captain, 0.400, 1.000);
TextDrawColor(Captain, COLOR_PURPLE);
TextDrawSetOutline(Captain, 1);
General = TextDrawCreate(490, 100, "Rank: General");
TextDrawAlignment(General, 1);
TextDrawFont(General, 2);
TextDrawLetterSize(General, 0.400, 1.000);
TextDrawColor(General, COLOR_TUT);
TextDrawSetOutline(General, 1);
return 1;
}
Ranks__connect(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
new string[50];
format(string, sizeof(string), "Welcome '%s', enjoy your stay !", player);
SetPVarInt(playerid, "pRank", 0);
return 1;
}
Ranks__spawn(playerid)
{
TextDrawShowForPlayer(playerid, Private);
TextDrawShowForPlayer(playerid, Corporal);
TextDrawShowForPlayer(playerid, Seargeant);
TextDrawShowForPlayer(playerid, Lieutenant);
TextDrawShowForPlayer(playerid, Captain);
TextDrawShowForPlayer(playerid, General);
if(IsPlayerLogged(playerid) == 0) { // If not logged in
TextDrawHideForPlayer(playerid, Private);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, General);
}
if(GetRank(playerid) == 0) { // Private
SetPlayerHealth(playerid, 50.0);
GivePlayerWeapon(playerid, 22, 300);
GivePlayerWeapon(playerid, 17, 500);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, General);
}
else if(GetRank(playerid) == 1) { // Baby Killa
SetPlayerHealth(playerid, 60.0);
SetPlayerArmour(playerid, 15.0);
GivePlayerWeapon(playerid, 23, 300);
GivePlayerWeapon(playerid, 17, 500);
GivePlayerWeapon(playerid, 5, 1);
TextDrawHideForPlayer(playerid, Private);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, General);
}
else if(GetRank(playerid) == 2) { // Seargeant
SetPlayerHealth(playerid, 70.0);
SetPlayerArmour(playerid, 25.0);
GivePlayerWeapon(playerid, 24, 150);
GivePlayerWeapon(playerid, 5, 1);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Private);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, General);
}
else if(GetRank(playerid) == 3) { // Lieutenant
SetPlayerHealth(playerid, 80.0);
SetPlayerArmour(playerid, 50.0);
GivePlayerWeapon(playerid, 29, 200);
GivePlayerWeapon(playerid, 24, 150);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Private);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, General);
}
else if(GetRank(playerid) == 4) { // Captain
SetPlayerHealth(playerid, 90.0);
SetPlayerArmour(playerid, 75.0);
GivePlayerWeapon(playerid, 34, 100);
GivePlayerWeapon(playerid, 24, 300);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Private);
TextDrawHideForPlayer(playerid, General);
}
else if(GetRank(playerid) == 5) { // Tha' General
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 27, 100);
GivePlayerWeapon(playerid, 24, 500);
GivePlayerWeapon(playerid, 31, 500);
TextDrawHideForPlayer(playerid, Corporal);
TextDrawHideForPlayer(playerid, Seargeant);
TextDrawHideForPlayer(playerid, Lieutenant);
TextDrawHideForPlayer(playerid, Captain);
TextDrawHideForPlayer(playerid, Private);
}
return 1;
}
Ranks__death(playerid, killerid, reason)
{
new string[256];
#pragma unused reason
if(GetPlayerScore(killerid) == 60 && GetRank(playerid) < 1)
{
GetName(killerid);
format(string, sizeof(string), ">> %s advanced to rank *Corporal'* by killing %d players", string, GetPlayerScore(killerid) );
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
SetPVarInt(playerid, "pRank", 1);
}
else if(GetPlayerScore(killerid) == 100 && GetRank(playerid) < 2)
{
GetName(killerid);
format(string, sizeof(string), ">> %s advanced to rank *Seargeant* by killing %d players", string, GetPlayerScore(killerid));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
SetPVarInt(playerid, "pRank", 2);
}
else if(GetPlayerScore(killerid) == 230 && GetRank(playerid) < 3)
{
GetName(killerid);
format(string, sizeof(string), ">> %s advanced to rank *Lieutenant'* by killing %d players", string, GetPlayerScore(killerid));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
SetPVarInt(playerid, "pRank", 3);
}
else if(GetPlayerScore(killerid) == 340 && GetRank(playerid) < 4)
{
GetName(killerid);
format(string, sizeof(string), ">> %s advanced to rank *Captain* by killing %d players", string, GetPlayerScore(killerid));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
SetPVarInt(playerid, "pRank", 4);
}
else if(GetPlayerScore(killerid) == 600 && GetRank(playerid) < 5)
{
GetName(killerid);
format(string, sizeof(string), ">> %s advanced to rank *The General* by killing %d players", string, GetPlayerScore(killerid));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
SetPVarInt(playerid, "pRank", 5);
}
return 1;
}
When I change of score it doesnt give me my new rank, I can see just the private textdraw, and when Im rank 1 I still can enter to the hydra.
Thanks. Pandita
Like Vince said, Vehicle ID is NOT Vehicle MODEL ID.