Guten Tag meine Scriptingfreunde,
ich wollte mal nach euerer Meinung zu meinem Killstreaksystem fragen, da ich glaube, dass es noch etwas rumbuggt.
der Score den man extra (10er, 15er streak usw.) bekommt, bleibt irgendwie mal gespeichert, mal nicht, der score durch kills funzt einwandfrei.
Schwer zu erklären, da es irgendwie manchmal klappt, manchmal nicht.
Hier der Code:
Code
public OnPlayerDeath(playerid, killerid, reason)
{
GivePlayerMoney(playerid, 100);
SendDeathMessage(killerid, playerid, reason);
if(killerid != INVALID_PLAYER_ID)
{
sInfo[killerid][level]++;
sInfo[killerid][kills]++;
sInfo[playerid][deaths]++;
SetPlayerScore(killerid, sInfo[killerid][level]);
GivePlayerMoney(killerid, 50);
sInfo[killerid][kstreak]++;
sInfo[playerid][kstreak] = 0;
}
if(sInfo[killerid][kstreak] == 5)
{
new string[128];
format(string,sizeof(string),"[Killstreak] {FFFFFF}%s is on a {f00a0a}5 {FFFFFF}killing spree (+2000 {41a22b}${FFFFFF})",getPlayerName(killerid));
SendClientMessageToAll(RED, string);
GivePlayerMoney(killerid, 2000);
SetPlayerHealth(killerid, 100);
SetPlayerArmour(killerid, 100);
savePlayer(killerid);
}
if(sInfo[killerid][kstreak] == 10)
{
new string[128];
format(string,sizeof(string),"[Killstreak] {FFFFFF}%s is on a {f00a0a}10 {FFFFFF}killing spree (5 Score + 4000 {41a22b}${FFFFFF})",getPlayerName(killerid));
SendClientMessageToAll(RED, string);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 5);
GivePlayerMoney(killerid, 4000);
SetPlayerHealth(killerid, 100);
SetPlayerArmour(killerid, 100);
savePlayer(killerid);
}
if(sInfo[killerid][kstreak] == 15)
{
new string[128];
format(string,sizeof(string),"[Killstreak] {FFFFFF}%s is on a {f00a0a}15 {FFFFFF}killing spree (10 Score + 8000 {41a22b}${FFFFFF})",getPlayerName(killerid));
SendClientMessageToAll(RED, string);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 10);
GivePlayerMoney(killerid, 8000);
SetPlayerHealth(killerid, 100);
SetPlayerArmour(killerid, 100);
savePlayer(killerid);
}
if(sInfo[killerid][kstreak] == 20)
{
new string[128];
format(string,sizeof(string),"[Killstreak] {FFFFFF}%s is on a {f00a0a}20 {FFFFFF}killing spree (20 Score + 12000 {41a22b}${FFFFFF})",getPlayerName(killerid));
SendClientMessageToAll(RED, string);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 20);
GivePlayerMoney(killerid, 12000);
SetPlayerHealth(killerid, 100);
SetPlayerArmour(killerid, 100);
savePlayer(killerid);
}
if(sInfo[killerid][kstreak] == 30)
{
new string[128];
format(string,sizeof(string),"[Killstreak] {FFFFFF}%s is on a {f00a0a}30 {FFFFFF}killing spree (40 Score + 18000 {41a22b}${FFFFFF})",getPlayerName(killerid));
SendClientMessageToAll(RED, string);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 40);
GivePlayerMoney(killerid, 18000);
SetPlayerHealth(killerid, 100);
SetPlayerArmour(killerid, 100);
savePlayer(killerid);
}
return 1;
}
Alles anzeigen
Könnte es sein, dass es etwas mit dem return zu tun hat, dass unter jede streak nochmal ein return 1; hin muss?
MFG