How can I-...
#1

How can I make a few classes restricted so only players with a tag can use it-..?
Reply
#2

Hmm Tell me the tag..
Reply
#3

https://sampwiki.blast.hk/wiki/Strfind
pawn Код:
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "[ABK]", false) != -1)
{
    //do stuff
}
Reply
#4

The tag is going to be [qK]
Reply
#5

Replace [ABK] with [qK]
Reply
#6

I can still join the team with that code...

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 2)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 3)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 4)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 5)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 6)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 7)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 8)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 9)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 10)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 11)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 12)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 13)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 14)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 15)
    {
        gTeam[playerid] = TEAM_QK;
        GameTextForPlayer(playerid, "qK Clan", 2000, 5);
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
        if(strfind(name, "[qK]", false) != -1)
        {
            SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member so this team is restricted.");
        }
    }
    return 1;
}
Reply
#7

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_QK)
    {
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
        if(strfind(name, "[qK]", false) != -1)
        {
            SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member. This team is restricted.");
            return 0;
        }
    }
    return 1;
}
This will stop them from spawning.
Reply
#8

C:\Documents and Settings\Lindvall\Mina dokument\Mina mottagna filer\QKDM.pwn(21 : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

[pawn]
The code is the { bracket in the top.
Reply
#9

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 2)
    {
        gTeam[playerid] = TEAM_MAFIA;
        GameTextForPlayer(playerid, "Mafia", 2000, 5);
    }
    else if(classid == 3)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 4)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 5)
    {
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police", 2000, 5);
    }
    else if(classid == 6)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 7)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 8)
    {
        gTeam[playerid] = TEAM_GROVE;
        GameTextForPlayer(playerid, "Grove", 2000, 5);
    }
    else if(classid == 9)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 10)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 11)
    {
        gTeam[playerid] = TEAM_BALLAS;
        GameTextForPlayer(playerid, "Ballas", 2000, 5);
    }
    else if(classid == 12)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 13)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 14)
    {
        gTeam[playerid] = TEAM_BIKERS;
        GameTextForPlayer(playerid, "Bikers", 2000, 5);
    }
    else if(classid == 15)
    {
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
        if(strfind(name, "[qK]", false) != -1)
        {
            SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member so this team is restricted.");
            return 0;
        }

        gTeam[playerid] = TEAM_QK;
        GameTextForPlayer(playerid, "qK Clan", 2000, 5);
    }
    return 1;
}
Reply
#10

Still able to join the team...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)