SA-MP Forums Archive
How can I-... - 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: How can I-... (/showthread.php?tid=345074)



How can I-... - HighPitchedVoice - 23.05.2012

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


Re: How can I-... - CristiD - 23.05.2012

Hmm Tell me the tag..


Re: How can I-... - [ABK]Antonio - 23.05.2012

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
}



Re: How can I-... - HighPitchedVoice - 23.05.2012

The tag is going to be [qK]


Re: How can I-... - [ABK]Antonio - 23.05.2012

Replace [ABK] with [qK]


Re: How can I-... - HighPitchedVoice - 23.05.2012

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



Re: How can I-... - [ABK]Antonio - 23.05.2012

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.


Re: How can I-... - HighPitchedVoice - 23.05.2012

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.


Re: How can I-... - Mandrakke - 23.05.2012

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



Re: How can I-... - HighPitchedVoice - 24.05.2012

Still able to join the team...