Donator class only level 1
#1

Hi,

I want to make that you can only use donator class with level 1 or higher.


My class code:
PHP код:
/*******************************************************************************
*                           <=[Skin Selection]=>                            *
*******************************************************************************/
   
public OnPlayerRequestClass(playeridclassid){
   
SetSkinToMeSkin[playerid]=500;
   new 
skin=GetPlayerSkin(playerid);
   switch(
skin){
      case 
125,124:{
        
SetPlayerPos(playerid, -382.5999,2206.6169,42.4236);
        
SetPlayerFacingAngle(playerid,280.0);
        if(
Options[TextLanguage]==2)GameTextForPlayer(playerid,"~r~TERRORISTS",2000,3);
        
SetPlayerColor(playerid,COLOR_LIGHTRED);SKIN[playerid]=skin;
        
SetPlayerCameraPos(playerid, -379.5999,2206.6169,42.4236);
        
SetPlayerCameraLookAt(playerid, -382.5999,2206.6169,42.4236);}
      case 
285,287:{
        
SetPlayerPos(playerid212.7791,1919.7570,17.6406);
        
SetPlayerFacingAngle(playerid,180.0);
        if(
Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3);
        
SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin;
        
SetPlayerCameraPos(playerid212.7791,1916.7570,17.6406);
        
SetPlayerCameraLookAt(playerid212.7791,1919.7570,17.6406);}
      case 
286:{
        
SetPlayerPos(playerid, -4.4729,1503.8311,12.8914);
        
SetPlayerFacingAngle(playerid,7.0);
        if(
Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3);
        
SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin;
        
SetPlayerCameraPos(playerid, -4.8970,1507.1229,12.8914);
           
SetPlayerCameraLookAt(playerid, -4.4729,1503.8311,12.8914);
        
GameTextForPlayer(playerid,"~b~DONATOR",2000,3);}}
   return 
1;} 
Reply
#2

depending level variables

PHP код:
new levelscore GetPlayerScore(playerid);
case 
286:{
    if(
levelscore >= 1)
    {
        
SetPlayerPos(playerid, -4.4729,1503.8311,12.8914);
        
SetPlayerFacingAngle(playerid,7.0);
        if(
Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3);
        
SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin;
        
SetPlayerCameraPos(playerid, -4.8970,1507.1229,12.8914);
        
SetPlayerCameraLookAt(playerid, -4.4729,1503.8311,12.8914);
        
GameTextForPlayer(playerid,"~b~DONATOR",2000,3);}}
    } 
Reply
#3

Don't work. Get this error:

PHP код:
C:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvtMike.pwn(1381) : error 002only a single statement (or expressioncan follow each "case"
C:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvtMike.pwn(1381) : warning 215expression has no effect 
Reply
#4

The script don't work, I tested it with no errors but it doesn't work. thanks btw! Someone else ?
Reply
#5

Just write it like this:

Код:
public OnPlayerRequestClass(playerid, classid){ 
   SetSkinToMeSkin[playerid]=500; 
   new skin=GetPlayerSkin(playerid); 
   switch(skin){ 
      case 125,124:{ 
        SetPlayerPos(playerid, -382.5999,2206.6169,42.4236); 
        SetPlayerFacingAngle(playerid,280.0); 
        if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~r~TERRORISTS",2000,3); 
        SetPlayerColor(playerid,COLOR_LIGHTRED);SKIN[playerid]=skin; 
        SetPlayerCameraPos(playerid, -379.5999,2206.6169,42.4236); 
        SetPlayerCameraLookAt(playerid, -382.5999,2206.6169,42.4236);} 
      case 285,287:{ 
        SetPlayerPos(playerid, 212.7791,1919.7570,17.6406); 
        SetPlayerFacingAngle(playerid,180.0); 
        if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3); 
        SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin; 
        SetPlayerCameraPos(playerid, 212.7791,1916.7570,17.6406); 
        SetPlayerCameraLookAt(playerid, 212.7791,1919.7570,17.6406);} 
      case 286:{ 
        if(GetPlayerScore(playerid) < 1) return 1;
        SetPlayerPos(playerid, -4.4729,1503.8311,12.8914); 
        SetPlayerFacingAngle(playerid,7.0); 
        if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3); 
        SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin; 
        SetPlayerCameraPos(playerid, -4.8970,1507.1229,12.8914); 
        SetPlayerCameraLookAt(playerid, -4.4729,1503.8311,12.8914); 
        GameTextForPlayer(playerid,"~b~DONATOR",2000,3);}} 
   return 1;}
Reply
#6

Код:
public OnPlayerRequestClass(playerid, classid){ 
   SetSkinToMeSkin[playerid]=500; 
   new skin=GetPlayerSkin(playerid); 
   switch(skin){ 
      case 125,124:{ 
        SetPlayerPos(playerid, -382.5999,2206.6169,42.4236); 
        SetPlayerFacingAngle(playerid,280.0); 
        if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~r~TERRORISTS",2000,3); 
        SetPlayerColor(playerid,COLOR_LIGHTRED);SKIN[playerid]=skin; 
        SetPlayerCameraPos(playerid, -379.5999,2206.6169,42.4236); 
        SetPlayerCameraLookAt(playerid, -382.5999,2206.6169,42.4236);} 
      case 285,287:{ 
        SetPlayerPos(playerid, 212.7791,1919.7570,17.6406); 
        SetPlayerFacingAngle(playerid,180.0); 
        if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3); 
        SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin; 
        SetPlayerCameraPos(playerid, 212.7791,1916.7570,17.6406); 
        SetPlayerCameraLookAt(playerid, 212.7791,1919.7570,17.6406);} 
      case 286:{ 
		if(YourDonatorVariable > 0)
		{
			SetPlayerPos(playerid, -4.4729,1503.8311,12.8914); 
			SetPlayerFacingAngle(playerid,7.0); 
			if(Options[TextLanguage]==2)GameTextForPlayer(playerid,"~b~SWAT",2000,3); 
			SetPlayerColor(playerid,COLOR_BLUE);SKIN[playerid]=skin; 
			SetPlayerCameraPos(playerid, -4.8970,1507.1229,12.8914); 
			SetPlayerCameraLookAt(playerid, -4.4729,1503.8311,12.8914); 
			GameTextForPlayer(playerid,"~b~DONATOR",2000,3);
		}
	}
	} 
		
   return 1;}
Reply
#7

Error:
PHP код:
SvT Mike\gamemodes\C_VS_T_4.1.pwn(1371) : error 017undefined symbol "YourDonatorVariable" 
Reply
#8

You must use your variable that identifies a player as donator.

Example:

Код:
MyVarRangDonator[MAX_PLAYERS];
PHP код:
/*******************************************************************************
*                           <=[Skin Selection]=>                            *
*******************************************************************************/
public OnPlayerRequestClass(playeridclassid)
{
    
SetSkinToMeSkin[playerid] = 500;
    new 
skin GetPlayerSkin(playerid);
    
    switch(
skin)
    {
        case 
125124:
        {
            
SetPlayerPos(playerid, -382.5999,2206.6169,42.4236);
            
SetPlayerFacingAngle(playerid,280.0);
            
            if(
Options[TextLanguage] == 2)
                
GameTextForPlayer(playerid,"~r~TERRORISTS",2000,3);
            
            
SetPlayerColor(playerid,COLOR_LIGHTRED), SKIN[playerid] = skin;
            
SetPlayerCameraPos(playerid, -379.5999,2206.6169,42.4236);
            
SetPlayerCameraLookAt(playerid, -382.5999,2206.6169,42.4236);
        }
        case 
285287:
        {
            
SetPlayerPos(playerid212.7791,1919.7570,17.6406);
            
SetPlayerFacingAngle(playerid,180.0);
            
            if(
Options[TextLanguage] == 2)
                
GameTextForPlayer(playerid,"~b~SWAT",2000,3);
                
            
SetPlayerColor(playerid,COLOR_BLUE), SKIN[playerid] = skin;
            
SetPlayerCameraPos(playerid212.7791,1916.7570,17.6406);
            
SetPlayerCameraLookAt(playerid212.7791,1919.7570,17.6406);
        }
        case 
286:
        {
            if(
MyVarRangeDonator[playerid] != 0)
            {
                
SetPlayerPos(playerid, -4.47291503.831112.8914);
                
SetPlayerFacingAngle(playerid7.0);
                if(
Options[TextLanguage] == 2)
                    
GameTextForPlayer(playerid"~b~SWAT"20003);
                
SetPlayerColor(playeridCOLOR_BLUE), SKIN[playerid] = skin;
                
SetPlayerCameraPos(playerid, -4.8970,1507.1229,12.8914);
                
SetPlayerCameraLookAt(playerid, -4.4729,1503.8311,12.8914);
                
GameTextForPlayer(playerid,"~b~DONATOR",2000,3);
               }
               else if(
MyVarRangDonator[playerid] < 1)
               {
                   
// if not is donator.
               
}
        }
    }
   return 
true;

Reply
#9

Error:

PHP код:
C:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvTMike.pwn(1388) : error 017undefined symbol "MyVarRangeDonator"
C:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvTMike.pwn(1388) : warning 215expression has no effect
C
:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvTMike.pwn(1388) : error 001expected token";"but found "]"
C:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvTMike.pwn(1388) : error 029invalid expressionassumed zero
C
:\Users\Administrator\Desktop\SvT Mike\gamemodes\SvTMike.pwn(1388) : fatal error 107too many error messages on one line 
Reply
#10

Sorry, I missed a character in the variable, you should also bear in mind that this is only an example, if you want to use this variable to give range donator to their players, you will have to assign values to the variable in a player and save the value of the variable.

change:

Код:
MyVarRangDonator[MAX_PLAYERS];
for:

Код:
MyVarRangeDonator[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)