20.07.2017, 07:07
I am trying a lot to make a team vehicles and when player did something all the team eran money from that...
Someone can help me with this please?
Someone can help me with this please?
CMD:action(playerid) //I did it under command. However you can use it anywhere like OnPlayerEnterCheckpoint in your case.
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) //Loop through all the players
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(i)) //You need to SetPlayerTeam first. Or use your team variable
{
SendClientMessage(i, -1, "You got score and money!"); //Notice that we used the i not playerid because we want to send it to the team not only to the player
GivePlayerMoney(i, 1000); //Giving $1000 to the team (including the player!)
SetPlayerScore(i, GetPlayerScore(i)+2); //Giving 2 score (same as above)
}
}
return 1;
}
You need to loop through all the players and get if the player team equal to any other player team.
Example: PHP код:
|