Kill streak system
#1

Im trying to create a killstreak system. How would i do this, i know it will be under OnPLayerDeath. But i dont know how the base will be. Heres what i want.

When the player gets a killstreak of 5 it will send them a message saying you are on a 5 kill streak! and it will give them a random weapon.

for 10 pretty much the same thing but it will give them unlimited life for about 1 minute. How would i to start this off? All i really need him with is the base not really the killstreak rewards
Reply
#2

pawn Код:
new Streak[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
    Streak[playerid] = 0;
    Streak[killerid]++;
    switch(Streak[killerid])
    {
        case 5: SendClientMessage(killerid, blue, "You are on a 5 killstreak");
        case 10:
        {
            SetPlayerHealth(killerid, 99999);
            SetTimerEx("stopinv",60000,0,"d",killerid);
        }
    }
    return 1;
}
forward stopinv(killerid);
public stopinv(killerid)
{
    SetPlayerHealth(killerid, 100);
    SendClientMessage(killerid, blue, "Your invincibilty ended!");
    return 1;
}
Reply
#3

Okay so here?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Streak[playerid] = 0;
    Streak[killerid]++;
    switch(Streak[playerid])
    {
        case 5: GameTextForPlayer(playerid,"~g~"You are on a 5 killstreak!",5000,5);
        case 10:
        {
            SetPlayerHealth(killerid, 99999);
            SetTimerEx("
stopinv",60000,0,"d",killerid);
        }
        GameTextForPlayer(playerid,"
~g~"You are on a 10 killstreak!",5000,5);
        case 15: GameTextForPlayer(playerid,"~g~"You are on a 15 killstreak!",5000,5);
        case 20: GameTextForPlayer(playerid,"
~g~"You are on a 20 killstreak!",5000,5);
        case 25: GameTextForPlayer(playerid,"~g~"You are on a 25 killstreak!",5000,5);
       
    }
    return 1;
}

forward stopinv(killerid);
public stopinv(killerid)
{
    SetPlayerHealth(killerid, 100);
    SendClientMessage(killerid, blue, "
Your invincibilty ended!");
    return 1;
}
Reply
#4

Use [ pawn ] not [ php ]..

pawn Код:
case 5:
{
      GameTextForPlayer(playerid,"~g~"You are on a 5 killstreak!",5000,5);
      GivePlayerMoney(playerid,5000);
}
Only a single statement or expression can follow each case.

Also, in the switch statement, use killerid..
Reply
#5

pawn Код:
Streak[playerid] = 0;
    Streak[killerid]++;
    switch(Streak[playerid])
    {
        case 5: GameTextForPlayer(playerid,"~r~You are on a ~g~5~rKillstreak!",5000,5);
        case 10:
        {
            GameTextForPlayer(playerid,"~r~You are on a ~g~10~rKillstreak!",5000,5);
            SetPlayerHealth(killerid, 99999);
            SetTimerEx("stopinv",60000,0,"d",killerid);
        }
        GameTextForPlayer(playerid,"~g~You are on a 10 killstreak!",5000,5);
        case 15: GameTextForPlayer(playerid,"~r~You are on a ~g~15~rKillstreak!",5000,5);
        case 20: GameTextForPlayer(playerid,"~r~You are on a ~g~20~rKillstreak!",5000,5);
        case 25: GameTextForPlayer(playerid,"~r~You are on a ~g~25~rKillstreak!",5000,5);

    }
    return 1;
}
Im getting errors

pawn Код:
C:\Documents and Settings\Chris\Desktop\Desktop\Mastalol\Grand Theft Auto San Andreas Samp Server\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(432) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(455) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(560) : warning 217: loose indentation
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(570) : error 002: only a single statement (or expression) can follow each "case"
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(570) : warning 215: expression has no effect
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(571) : error 014: invalid statement; not in switch
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(571) : warning 215: expression has no effect
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(571) : error 001: expected token: ";", but found ":"
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(571) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Chris\Desktop\Desktop\SAMP Server\gamemodes\WorldWar.pwn(571) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#6

Put GameTextForPlayer(playerid,"~g~You are on a 10 killstreak!",5000,5); inside case 10: { }


Quote:
Originally Posted by Snipa
Посмотреть сообщение
Also, in the switch statement, use killerid..
Reply
#7

Quote:
Originally Posted by Snipa
Посмотреть сообщение
Put GameTextForPlayer(playerid,"~g~You are on a 10 killstreak!",5000,5); inside case 10: { }
Haha sorry for all my problems but when i do remove that i get 26 errors
Reply
#8

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Streak[playerid] = 0;
    if(IsPlayerConnected(killerid))
    {
        Streak[killerid]++;
        switch(Streak[killerid])
        {
            case 5: GameTextForPlayer(killerid,"~g~You are on a 5 killstreak!",5000,5);
            case 10: GameTextForPlayer(killerid,"~g~You are on a 10 killstreak!",5000,5);
            case 15: GameTextForPlayer(killerid,"~g~You are on a 15 killstreak!",5000,5);
            case 20: GameTextForPlayer(killerid,"~g~You are on a 20 killstreak!",5000,5);
            case 25: GameTextForPlayer(killerid,"~g~You are on a 25 killstreak!",5000,5);
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Streak[playerid] = 0;
    if(IsPlayerConnected(killerid))
    {
        Streak[killerid]++;
        switch(Streak[killerid])
        {
            case 5: GameTextForPlayer(killerid,"~g~You are on a 5 killstreak!",5000,5);
            case 10: GameTextForPlayer(killerid,"~g~You are on a 10 killstreak!",5000,5);
            case 15: GameTextForPlayer(killerid,"~g~You are on a 15 killstreak!",5000,5);
            case 20: GameTextForPlayer(killerid,"~g~You are on a 20 killstreak!",5000,5);
            case 25: GameTextForPlayer(killerid,"~g~You are on a 25 killstreak!",5000,5);
        }
    }
    return 1;
}
I fixed it, i was trying to return it when it wasnt ready to be returned But do you know how it would to give a minigun for 1 minute then take it back?
Reply
#10

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
how it would to give a minigun for 1 minute then take it back?
pawn Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
    new WeaponData[12][2];
    for(new i=1; i < sizeof(WeaponData); i++)
    {
        GetPlayerWeaponData(playerid, i, WeaponData[i][0], WeaponData[i][1]);
    }
    ResetPlayerWeapons(playerid);
    for(new i=1; i < sizeof(WeaponData); i++)
    {
        if(WeaponData[i][0] != weaponid)
        {
            GivePlayerWeapon(playerid, WeaponData[i][0], WeaponData[i][1]);
        }
    }
}
pawn Код:
public RemoveMinigun(playerid)
{
    RemovePlayerWeapon(playerid, WEAPON_MINIGUN);
}
OnPlayerDeath
pawn Код:
GivePlayerWeapon(killerid, WEAPON_MINIGUN, 500);
SetTimerEx("RemoveMinigun", 60000, false, "d", killerid);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)