SA-MP Forums Archive
Class on Score? HELP! - 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: Class on Score? HELP! (/showthread.php?tid=575595)



Class on Score? HELP! - Charalambos26 - 28.05.2015

Hello,
I have this script


((Under OnPlayerSpawn))
Код HTML:
        case MEDIC:
        {
            TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid, 33, 200);
	  		GivePlayerWeapon(playerid, 22, 200);
	    	GivePlayerWeapon(playerid, 25, 200);
	     	GivePlayerWeapon(playerid, 11, 2);
        }
Now I want to make it so, that if a player is score 500 he could join this,
But I don't know how, please help.


Re: Class on Score? HELP! - FplayerGR - 28.05.2015

Код:
 case MEDIC:
        {
               if(GetPlayerScore(playerid) >= 500){
                TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, 33, 200);
	  	GivePlayerWeapon(playerid, 22, 200);
	    	GivePlayerWeapon(playerid, 25, 200);
	     	GivePlayerWeapon(playerid, 11, 2);
               }
        }
this?


Re: Class on Score? HELP! - Charalambos26 - 28.05.2015

Quote:
Originally Posted by FplayerGR
Посмотреть сообщение
Код:
 case MEDIC:
        {
               if(GetPlayerScore(playerid) >= 500){
                TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, 33, 200);
	  	GivePlayerWeapon(playerid, 22, 200);
	    	GivePlayerWeapon(playerid, 25, 200);
	     	GivePlayerWeapon(playerid, 11, 2);
               }
        }
this?
isn't working,


Re: Class on Score? HELP! - Konstantinos - 28.05.2015

Check if the player's score is less than 500 when selecting "Medic" team and return an error to inform them. OnPlayerSpawn callback has nothing to do with it by the way.


Re: Class on Score? HELP! - Charalambos26 - 28.05.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Check if the player's score is less than 500 when selecting "Medic" team and return an error to inform them. OnPlayerSpawn callback has nothing to do with it by the way.
sry but im not good at scripting, can you may edit it so,that it is for score 500?


Re: Class on Score? HELP! - J4Rr3x - 28.05.2015

You need to put this in OnPlayerRequestSpawn.

Little fix:
PHP код:
case MEDIC:
        {
               if(
GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, -1"You need 500 score");
               
TogglePlayerControllable(playerid1);
           
ResetPlayerWeapons(playerid);
           
GivePlayerWeapon(playerid33200);
           
GivePlayerWeapon(playerid22200);
           
GivePlayerWeapon(playerid25200);
           
GivePlayerWeapon(playerid112);
        } 



Re: Class on Score? HELP! - Charalambos26 - 28.05.2015

Quote:
Originally Posted by J4Rr3x
Посмотреть сообщение
You need to put this in OnPlayerRequestSpawn.

Little fix:
PHP код:
case MEDIC:
        {
               if(
GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, -1"You need 500 score");
               
TogglePlayerControllable(playerid1);
           
ResetPlayerWeapons(playerid);
           
GivePlayerWeapon(playerid33200);
           
GivePlayerWeapon(playerid22200);
           
GivePlayerWeapon(playerid25200);
           
GivePlayerWeapon(playerid112);
        } 
But this is not a Team, just a class. should I leave it there, where it was?


Re: Class on Score? HELP! - Charalambos26 - 28.05.2015

Quote:
Originally Posted by J4Rr3x
Посмотреть сообщение
You need to put this in OnPlayerRequestSpawn.

Little fix:
PHP код:
case MEDIC:
        {
               if(
GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, -1"You need 500 score");
               
TogglePlayerControllable(playerid1);
           
ResetPlayerWeapons(playerid);
           
GivePlayerWeapon(playerid33200);
           
GivePlayerWeapon(playerid22200);
           
GivePlayerWeapon(playerid25200);
           
GivePlayerWeapon(playerid112);
        } 
Not workin,


Re: Class on Score? HELP! - PowerPC603 - 28.05.2015

Return 0 to prevent spawning in this callback:
https://sampwiki.blast.hk/wiki/OnPlayerRequestSpawn

PHP код:
case MEDIC:
{
    if(
GetPlayerScore(playerid) < 500)
    {
        
SendClientMessage(playerid, -1"You need 500 score to select this class");
        return 
0;
    }
    
TogglePlayerControllable(playerid1);
    
ResetPlayerWeapons(playerid);
    
GivePlayerWeapon(playerid33200);
    
GivePlayerWeapon(playerid22200);
    
GivePlayerWeapon(playerid25200);
    
GivePlayerWeapon(playerid112);