SA-MP Forums Archive
distance assist systeam - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: distance assist systeam (/showthread.php?tid=616642)



distance assist systeam - bboytimix - 08.09.2016

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


Re: distance assist systeam - venomlivno8 - 08.09.2016

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



Re: distance assist systeam - Shinja - 08.09.2016

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;




Re: distance assist systeam - bboytimix - 09.09.2016

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 ??


Re: distance assist systeam - Shinja - 09.09.2016

Can you show the full code


Re: distance assist systeam - bboytimix - 09.09.2016

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



Re: distance assist systeam - bboytimix - 09.09.2016

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


Re: distance assist systeam - Shinja - 09.09.2016

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



Re: distance assist systeam - SickAttack - 09.09.2016

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 ++)


Re: distance assist systeam - Shinja - 09.09.2016

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;