SA-MP Forums Archive
Please help +Rep - 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: Please help +Rep (/showthread.php?tid=637718)



Please help +Rep - CheckItOut - 20.07.2017

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?


Re: Please help +Rep - FailerZ - 20.07.2017

You need to loop through all the players and get if the player team equal to any other player team.

Example:
PHP код:
CMD:action(playerid//I did it under command. However you can use it anywhere like OnPlayerEnterCheckpoint in your case.
{
    for(new 
0GetPlayerPoolSize(); <= ji++) //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(i1000); //Giving $1000 to the team (including the player!)
            
SetPlayerScore(iGetPlayerScore(i)+2); //Giving 2 score (same as above)
        
}
    }
    return 
1;




Re: Please help +Rep - CheckItOut - 20.07.2017

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
You need to loop through all the players and get if the player team equal to any other player team.

Example:
PHP код:
CMD:action(playerid//I did it under command. However you can use it anywhere like OnPlayerEnterCheckpoint in your case.
{
    for(new 
0GetPlayerPoolSize(); <= ji++) //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(i1000); //Giving $1000 to the team (including the player!)
            
SetPlayerScore(iGetPlayerScore(i)+2); //Giving 2 score (same as above)
        
}
    }
    return 
1;

Thank u very much!