16.02.2013, 23:32
(
Последний раз редактировалось stormchaser206; 17.02.2013 в 01:25.
)
How to change timer to check if XP is equal or above and below a certain amount, and only check once.
Here is my code:
As you can see, it is only set to check if it is equal to, not more...
So, I want to know how to change it so it checks if it above or equal too that, but below the next case, and only check once.
Thank you.
FIXED
Here is my code:
pawn Код:
public RankDetection(playerid)
{
switch(PlayerInfo[playerid][Xp])
{
case 20:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Private II!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 45:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Private First Class!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 70:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Specialist!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 120:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Corporal!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 170:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Sergeant!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 250:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Sergeant First Class!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 400:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Master Sergeant!");
IncreasePlayerXp(playerid,1);
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
}
case 650:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to First Sergeant!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 1000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Sergeant Major!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 1500:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Command Sergeant Major!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 2100:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Sergeant Major of the Army!");
IncreasePlayerXp(playerid,1);
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
}
case 2800:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Warrant Officer!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 3900:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Chief Warrant Officer 2!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 5000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Chief Warrant Officer 3!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 7500:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Chief Warrant Officer 4!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 10000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Chief Warrant Officer 5!");
IncreasePlayerXp(playerid,1);
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
}
case 15000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Second Lieutenant!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 19000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to First Lieutenant!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 27000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Captain!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 35000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Major!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 50000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Lieutenant Colonel!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 70000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Colonel!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 100000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Brigadier General!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 120000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Major General!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 150000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to Lieutenant General!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 200000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to General!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
}
case 300000:
{
SendClientMessage(playerid, COLOR_GREEN, "You have been promoted to General of the Army!");
PlayAudioStreamForPlayer(playerid, "https://dl.dropbox.com/u/77376451/rankupmwffa.mp3");
IncreasePlayerXp(playerid,1);
GivePlayerAchievement(playerid, Ach_WhoDaresWins, 1);
}
}
SetPlayerScore(playerid, PlayerInfo[playerid][Xp]);
return 1;
}
So, I want to know how to change it so it checks if it above or equal too that, but below the next case, and only check once.
Thank you.
FIXED