08.09.2016, 12:24
get a +1 score only if im near the KILLERID from my team
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;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float: x, Float: y, Float: z;
GetPlayerPos(killerid, x, y, z);
for(new i, j=GetPlayerPoolSize(); i <= j; i++)
{
if(GetPlayerTeam(i) == GetPlayerTeam(killerid) && IsPlayerInRangeOfPoint(i, 5.0, x, y, z)) {
SetPlayerScore(i, GetPlayerScore(i)+1);
}
}
return 1;
}
|
Why variables?
PHP код:
|
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");
}
}
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");
}
}
for(new j = 0; j < MAX_PLAYERS; j++)//j = THE NEAR COPS
|
Why variables?
PHP код:
|