Killing
#1

Hey guys, how can I make so when a player from grove team kill a guy from balla the guy from the grove team gets +10 score and +15.000 money.
Reply
#2

What are the #define's for the teams?
Reply
#3

Quote:
Originally Posted by iGetty
Посмотреть сообщение
What are the #define's for the teams?
#define GROVE 2
#define BALLA 3
Reply
#4

Do you have a variable like:

pawn Код:
gTeam[playerid] = GROVE;
and

pawn Код:
gTeam[playerid] = BALLA;
Reply
#5

Quote:
Originally Posted by iGetty
Посмотреть сообщение
Do you have a variable like:

pawn Код:
gTeam[playerid] = GROVE;
and

pawn Код:
gTeam[playerid] = BALLA;
I dont have it but I have
pawn Код:
else if(classid == 1)
    {
        gTeam[playerid] = Balla;
        GameTextForPlayer(playerid,"~pu~Balla",3000,5);
        SetPlayerPos(playerid,2100.6926,1683.2804,13.0060);
        SetPlayerCameraPos(playerid,2105.7258,1683.1344,12.9479);
        SetPlayerCameraLookAt(playerid,2100.6926,1683.2804,13.0060);
        SetPlayerFacingAngle(playerid,269.1398);
        SetPlayerColor(playerid, COLOR_PURPLE);
    }
    else if(classid == 2)
    {
        gTeam[playerid] = Grove;
        GameTextForPlayer(playerid,"~g~Grove",3000,5);
        SetPlayerPos(playerid,2100.6926,1683.2804,13.0060);
        SetPlayerCameraPos(playerid,2105.7258,1683.1344,12.9479);
        SetPlayerCameraLookAt(playerid,2100.6926,1683.2804,13.0060);
        SetPlayerFacingAngle(playerid,269.1398);
        SetPlayerColor(playerid, COLOR_GREEN);
    }
Reply
#6

That's fine. All you need to do is this under

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == Balla && gTeam[playerid] == Grove)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(playerid, GetPlayerMoney(killerid)+15000);
    }
    if(gTeam[killerid] == Grove && gTeam[playerid] == Balla)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(playerid, GetPlayerMoney(killerid)+15000);
    }
}
Reply
#7

iGetty, I don't think you need to GetPlayerMoney(killerid)+15000, just 15000 will work, otherwise you're giving current money + 15000, so 30000+15000=45000, as you're using give and not reset.

Also the playerid seemed incorrect.

So with that given, I believe the code should work fine like this.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == Balla && gTeam[playerid] == Grove)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(killerid, 15000);
    }
    if(gTeam[killerid] == Grove && gTeam[playerid] == Balla)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(killerid, 15000);
    }
}
Although if every player is part of either grove or balla
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(killerid, 15000);
}
will work aswell
Reply
#8

Quote:
Originally Posted by iGetty
Посмотреть сообщение
That's fine. All you need to do is this under

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == Balla && gTeam[playerid] == Grove)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(playerid, GetPlayerMoney(killerid)+15000);
    }
    if(gTeam[killerid] == Grove && gTeam[playerid] == Balla)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        GivePlayerMoney(playerid, GetPlayerMoney(killerid)+15000);
    }
}
Thanks man but I get this error:
pawn Код:
(674) : warning 213: tag mismatch
Line 674:
pawn Код:
if(gTeam[killerid] == Grove && gTeam[playerid] == Balla)
Reply
#9

Much simpler solution:
pawn Код:
public OnPlayerDeath(playerid, killerid,reason)
{
    if(killerid != INVALID_PLAYER_ID && gTeam[playerid] != gTeam[killerid])
    {
        GivePlayerMoney(killerid,15000);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+10);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)