21.08.2012, 22:57
(
Последний раз редактировалось ThePhenix; 24.08.2012 в 05:36.
)
Hi,
I'm gonna show, how to add a Spree system in your Gamemode.
1.-
Add the new variable, we have to declare it:
2.-
We'll declare the Text for the Spree. We have just to declare it!
3.-
We have to add the function, which will hide the Spree text for the players!
4.-
We have to create the TextDraw for the spree, it will be shown for the players!
5.-
Add the function to destroy the Spree TextDraw.
6.-
We have to create the Messages that will be sent, when the player reaches a spree kill!
Hope it be useful for many people.
I'm gonna show, how to add a Spree system in your Gamemode.
1.-
Add the new variable, we have to declare it:
pawn Код:
new spree[MAX_PLAYERS];
pawn Код:
new Text:Spree;
3.-
pawn Код:
forward Txtreset();
public Txtreset()
{
TextDrawHideForAll(Spree);
return 1;
}
4.-
pawn Код:
public OnGameModeInit()
{
Spree = TextDrawCreate(9.000000,310.000000,"%s is on a killing spree of i kills.");
TextDrawAlignment(Spree,0);
TextDrawBackgroundColor(Spree,0x000000ff);
TextDrawFont(Spree,3);
TextDrawLetterSize(Spree,0.299999,0.799999);
TextDrawColor(Spree,0xffffffff);
TextDrawSetOutline(Spree,1);
TextDrawSetProportional(Spree,1);
TextDrawSetShadow(Spree,1);
TextDrawHideForAll(Spree);
return 1;
}
5.-
pawn Код:
public OnGameModeExit()
{
TextDrawDestroy(Spree);
return 1;
}
6.-
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
spree[killerid]++;
if(spree[killerid] == 2) {
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName, sizeof(pName));
format(string, sizeof(string), "%s is on a killing spree, with 5 kills", pName); //It goes for 2 kills
TextDrawHideForAll(Spree);
TextDrawSetString(Spree, string);
TextDrawShowForAll(Spree); SetTimer("TxtReset", 3000, 0);
}
if(spree[killerid] == 7) {
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName, sizeof(pName));
format(string, sizeof(string), "%s is on a killing spree, with 7 kills!", pName);//it goes for 7 kills!
TextDrawHideForAll(Spree);
TextDrawSetString(Spree, string);
TextDrawShowForAll(Spree); SetTimer("TxtReset", 3000, 0);
//Here you can add a function or a special action with 7 kills
}
if(spree[killerid] == 10) {
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName, sizeof(pName));
format(string, sizeof(string), "%s is on a killing spre with 10 kills~", pName);//It goes for 10 kills
TextDrawHideForAll(Spree);
TextDrawSetString(Spree, string);
TextDrawShowForAll(Spree); SetTimer("TxtReset", 3000, 0);//You can add more if you want!
}
return 1;
}
Hope it be useful for many people.