SA-MP Forums Archive
Team restriction - 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: Team restriction (/showthread.php?tid=316864)



Team restriction - Twinki1993 - 08.02.2012

Well I want to make when player spawns as VIP, if he doesnt have 100+ score he will get killed and returned back to skin selection... Not working...

PHP код:
else if(GetPlayerTeam(playerid) == TEAM_VIP)
    {
        if(
GetPlayerScore(playerid) < 100) return SetPlayerHealth(playerid0);
        {
            
SendClientMessage(playeridCOLOR_BLUE"<!>You must have 50 score to join this team");
              
SetPlayerHealth(playerid,100);
              
SetPlayerArmour(playerid,100);
              
SetPlayerPos(playerid,-1391.1643,496.9996,18.2344);//VIP
              
SendClientMessage(playeridCOLOR_LIGHTBLUE"<!>You've made decision. You are now part of Team VIP. Use /teamhelp to see commands! Enjoy!");
        }
    } 
PHP код:
if(classid == 3)
  {
          
gTeam[playerid] = TEAM_VIP;
        
SetPlayerTeam(playerid,TEAM_VIP);
        
GameTextForPlayer(playerid,"~r~VIP",2000,3);
  } 
What happends is that player spawns without getting killed if he have less than 100 score... I want to make it, it will be killed if he doesnt have required score


Re: Team restriction - [ABK]Antonio - 08.02.2012

put an if statement on OnPlayerRequestSpawn that returns 0 if they don't have the right credentials


Re: Team restriction - Twinki1993 - 09.02.2012

Tried with it. Same.
Quote:

if(GetPlayerScore(playerid) < 100) return SetPlayerHealth(playerid, 0);
{
SendClientMessage(playerid, COLOR_BLUE, "<!>You must have 50 score to join this team");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
SetPlayerPos(playerid,-1391.1643,496.9996,18.2344);//VIP
SendClientMessage(playerid, COLOR_LIGHTBLUE, "<!>You've made decision. You are now part of Team VIP. Use /teamhelp to see commands! Enjoy!");
}
return 0;
}




Re: Team restriction - [ABK]Antonio - 09.02.2012

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerSkin(MySkin)) //A skin or gTeam or whatever you want
    {
        if(GetPlayerScore(playerid) < 100)
        {
            SendClientMessage(playerid, 0xCC0000AA, "You can't spawn as this class!");
            return 0;
        }
    }
    return 1;
}