Killstreak?
#1

How do i make this, Make this command for only a person with a 5 killstreak?
Reply
#2

Count kills on OnPlayerDeath, save them to a variable, then when somebody uses that command check if that variable equales to 5 or more.
Reply
#3

Unfortunately none of that, helped, give me an example?
Reply
#4

Use something like

OnPlayerDeath

kills++

if(kills == 5)

code here



I'll post something more advanced later, I'm rapping to Eminem atm. <3
Reply
#5

pawn Код:
new pKills[MAX_PLAYERS];

public OnPlayerDeath(...)
{
    pKills[killerid]++;
    if(pKills[killerid] == 5)
    {
        SendClientMessage(killerid, COLOR, "You now have 5 kills!");
    }  
    return 1;
}
Reply
#6

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) // You count kills here.
{
    SetPVarInt(killerid,"KillStreak",GetPVarInt(killerid,"KillStreak") + 1);
    SetPVarInt(playerid,"KillStreak",0);
    return 1;
}

// And when you make a command, you add this check before it can be used:

if(GetPVarInt(playerid,"KillStreak") >= 5)
Reply
#7

Quote:
Originally Posted by BigAl
Посмотреть сообщение
How do i make this, Make this command for only a person with a 5 killstreak?
Top of script:
pawn Код:
new pKills[MAX_PLAYERS];
OnPlayerConnect (OnPlayerDisconnect to if you want):
pawn Код:
pKills[playerid] = 0;
OnPlayerDeath:
pawn Код:
pKills[killerid]++; //Add one kill to the one who killed.
pKills[playerid] = 0; //When someone dies, reset their kills.
OnPlayerCommandText:
pawn Код:
if(strcmp(cmdtext, "/command", true)==0)
{
    if(pKills[playerid] => 5)
    {
        //Code here
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000FF, "You need to have a killstreak of 5 kills or more to use this command.");
    }
    return 1;
}
Reply
#8

C:\Users\Ross\Desktop\G2x andreas\gamemodes\UltimatePwnage.pwn(171) : warning 211: possibly unintended assignment
C:\Users\Ross\Desktop\G2x andreas\gamemodes\UltimatePwnage.pwn(171) : error 029: invalid expression, assumed zero
C:\Users\Ross\Desktop\G2x andreas\gamemodes\UltimatePwnage.pwn(171) : warning 215: expression has no effect
C:\Users\Ross\Desktop\G2x andreas\gamemodes\UltimatePwnage.pwn(17 : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

if(pKills[playerid] => 5)

I get them errors when i put that in :/
Reply
#9

if(pKills[killerid] > 5)
{
code
}
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)