08.03.2013, 23:27
pawn Код:
CMD:kstreak(playerid, cmdtext)
{
if(KillStreak[playerid] >= 5)
{
if(!UsedKStreak[playerid] == true) return SendClientMessage(playerid, CriminalsColor, "You already used it, faggot!");
{
SetPlayerPos(playerid, -25.884498,-185.868988,1003.546875);
SetPlayerInterior(playerid, 17);
SetCameraBehindPlayer(playerid);
UsedKStreak[playerid] = false;
}
}
else
{
SendClientMessage(playerid, CriminalsColor, "You have insufficient kills!");
}
return 1;
}
I have playerid as Im testing this by killing myself, it will be changed back to killerid once I have someone to test with
OnPlayerDeath callback
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(killerid) < 6)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) +1);
}
KillStreak[killerid]++;
GivePlayerMoney(killerid, 1000);
}
SetPlayerWantedLevel(playerid, 0);
//delete me
KillStreak[playerid] ++;
if(KillStreak[playerid] == 5)
{
SendClientMessage(playerid, CriminalsColor, "You can now use kstreak");
}
new string[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, PlayerName, sizeof(PlayerName));
switch(KillStreak[playerid])
{
case 5:
{
format(string, sizeof(string), "%s is dominating", killerid);
SendClientMessageToAll(CriminalsColor, string);
UsedKStreak[playerid] = true;
}
case 10:
{
format(string, sizeof(string), "%s is still dominating", killerid);
SendClientMessageToAll(CriminalsColor, string);
}
case 20:
{
format(string, sizeof(string), "%s has dominated!", killerid);
SendClientMessageToAll(CriminalsColor, string);
}
}
return 1;
}