Killstreaks
#1

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 type /kstreak once I have a killstreak of 5 and I teleport which is what I want it too do. Although once I've used the command once, I can use it again and again until I die... I want to make it so when I call the killstreak or whatever in, I can't do it again until I die and get the killstreak again...

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;
}
Reply
#2

In the first box. put return sendclient..... at the end of the if statement, so after usedks is false.
On phone now...
You are now stopping the if statement without running the code after that..
GL with ur project!
Reply
#3

Quote:

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;
}

UsedKStreak[playerid] = false; should be UsedKStreak[playerid] = ture; ?
Reply
#4

I don't think so because I have to set the variable back to false for it to no longer work... until you die and regain the correct killstreak.
Reply
#5

Bump, still needs fixing!
Reply
#6

as i can see when you're checking if player used that command you use != = false

try changing this
pawn Код:
if(!UsedKStreak[playerid] == true) return SendClientMessage(playerid, CriminalsColor, "You already used it, faggot!");
TO

pawn Код:
if(UsedKStreak[playerid] == true) return SendClientMessage(playerid, CriminalsColor, "You already used it, faggot!");
Reply
#7

I tried that and it gives me a warning saying tag mismatch, at least it did last time. Let me have another look
Reply
#8

can you show me the UsedKStreak Variable?

EDIT
i edited your command try this one

pawn Код:
CMD:kstreak(playerid, cmdtext)
{
    if(KillStreak[playerid] < 5)
        return SendClientMessage(playerid, CriminalsColor, "You have insufficient kills!");
    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;
    return 1;
}
Reply
#9

pawn Код:
new UsedKStreak[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)