Class on Score? HELP!
#1

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.
Reply
#2

Код:
 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?
Reply
#3

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,
Reply
#4

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.
Reply
#5

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?
Reply
#6

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);
        } 
Reply
#7

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?
Reply
#8

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,
Reply
#9

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)