distance assist systeam
#1

get a +1 score only if im near the KILLERID from my team
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    new Float: x, Float: y, Float: z;
    GetPlayerPos(killerid, x, y, z);
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(PlayerInfo[i][pTeam] == PlayerInfo[killerid][pTeam] && IsPlayerInRangeOfPoint(i, 5.0, x, y, z)) {
            PlayerInfo[i][pScore]++;
        }
    }
    return 1;
}
Reply
#3

Why variables?
PHP код:
public OnPlayerDeath(playeridkilleridreason
{
    new 
FloatxFloatyFloatz;
    
GetPlayerPos(killeridxyz);
    for(new 
ij=GetPlayerPoolSize(); <= ji++) 
        {
        if(
GetPlayerTeam(i) == GetPlayerTeam(killerid) && IsPlayerInRangeOfPoint(i5.0xyz)) {
            
SetPlayerScore(iGetPlayerScore(i)+1);
        }
    }
    return 
1;

Reply
#4

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Why variables?
PHP код:
public OnPlayerDeath(playeridkilleridreason
{
    new 
FloatxFloatyFloatz;
    
GetPlayerPos(killeridxyz);
    for(new 
ij=GetPlayerPoolSize(); <= ji++) 
        {
        if(
GetPlayerTeam(i) == GetPlayerTeam(killerid) && IsPlayerInRangeOfPoint(i5.0xyz)) {
            
SetPlayerScore(iGetPlayerScore(i)+1);
        }
    }
    return 
1;

hey thanks
i tried to make the same but here
pawn Код:
if(Health <= 6.0)
                {
                    JailPlayer(i);//robber
                    GivePlayerEXP(playerid);//playerid = THE KILLER/MAIN COP
                    CheckCopLevel(playerid);
                    for(new j = 0; i < MAX_PLAYERS; i++)//j = THE NEAR COPS
                    if(Team[j] == COP && IsPlayerInRangeOfPoint(j, 5.0, x, y, z))//THE ANOTHER NEAR COPS
                    {

                            PInfo[j][XPtoNearCop] = 1;
                            PInfo[j][Assists]++;
                            GiveNearCopPlayerXP(j);
                            SendClientMessage(j, red,"+12exp assist For TEAMWORK");
                    }
                }
i tested it but its not workin hats the problem ??
Reply
#5

Can you show the full code
Reply
#6

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Can you show the full code
pawn Код:
if(PRESSED(KEY_FIRE))
    {
                                GetPlayerHealth(i,Health);// i = the ROBBER
                                SetPlayerHealth(i,Health-5);
                                SetTimerEx("CantAtack",1000,0,"i",playerid);
                                PInfo[playerid][CanAtack] = 0;
                if(Health <= 6.0)
                {
                    JailPlayer(i);// i = robber
                    GivePlayerEXP(playerid);//playerid = THE KILLER/MAIN COP
                    CheckCopLevel(playerid);
                    for(new j = 0; i < MAX_PLAYERS; i++)//j = THE NEAR COPS
                    if(Team[j] == COP && IsPlayerInRangeOfPoint(j, 5.0, x, y, z))//THE ANOTHER NEAR COPS
                    {

                            PInfo[j][XPtoNearCop] = 1;
                            PInfo[j][Assists]++;
                            GiveNearCopPlayerXP(j);
                            SendClientMessage(j, red,"+12exp assist For TEAMWORK");
                    }
                }
Reply
#7

only the assist doesnt work i cant see the massage the assist added in stats ,just nothing happend
Reply
#8

Your loop is wrong
PHP код:
for(new 0MAX_PLAYERSj++)//j = THE NEAR COPS 
Reply
#9

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Your loop is wrong
PHP код:
for(new 0MAX_PLAYERSj++)//j = THE NEAR COPS 
for(new j = 0, k = GetPlayerPoolSize(); j <= k; j ++)
Reply
#10

That's what i already told him here ^, now i just fixed his mistake
Quote:
Originally Posted by Shinja
Посмотреть сообщение
Why variables?
PHP код:
public OnPlayerDeath(playeridkilleridreason
{
    new 
FloatxFloatyFloatz;
    
GetPlayerPos(killeridxyz);
    for(new 
ij=GetPlayerPoolSize(); <= ji++) 
        {
        if(
GetPlayerTeam(i) == GetPlayerTeam(killerid) && IsPlayerInRangeOfPoint(i5.0xyz)) {
            
SetPlayerScore(iGetPlayerScore(i)+1);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)