class restriction
#1

pawn Код:
if(classid == 2) {
    GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
how do I restrict it.

pawn Код:
if(classid == 2 && PlayerInfo[playerid][pFaction] == 1) {
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
I am no brianiac, and I've got a problem today, I kept thinking about it, so I couldn't fix some simple things.
Reply
#2

you are close enough though.
Read this:
https://sampwiki.blast.hk/wiki/OnPlayerRequestClass
Quote:

Returns Returning 0 in this callback will prevent the player from spawning. The player can be forced to spawn when SpawnPlayer is used, however the player will re-enter class selection the next time they die.

so here,

pawn Код:
if(classid == 2)
{
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        if( PlayerInfo[playerid][pFaction] != ONE_REQUIRED_TO_BE_IN_THIS_TEAM )
        {
                  SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
                  return 0;
        }
}
PlayerInfo[playerid][pFaction] != ONE_REQUIRED_TO_BE_IN_THIS_TEAM
if the value of pFaction is not equal to that value required to be in this team deny the spawn. else go for it.
Reply
#3

Код:
if(classid == 2 && PlayerInfo[playerid][pFaction] == 1) 
{
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        // Your codes
} else SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
Reply
#4

Quote:
Originally Posted by ChristianIvann09
Посмотреть сообщение
Код:
if(classid == 2 && PlayerInfo[playerid][pFaction] == 1) 
{
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        // Your codes
} else SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
i doubt that would even work. Player will spawn in both conditions.
Reply
#5

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
you are close enough though.
Read this:
https://sampwiki.blast.hk/wiki/OnPlayerRequestClass


so here,

pawn Код:
if(classid == 2)
{
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        if( PlayerInfo[playerid][pFaction] != ONE_REQUIRED_TO_BE_IN_THIS_TEAM )
        {
                  SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
                  return 0;
        }
}
PlayerInfo[playerid][pFaction] != ONE_REQUIRED_TO_BE_IN_THIS_TEAM
if the value of pFaction is not equal to that value required to be in this team deny the spawn. else go for it.
Nothing pops out when I put this

pawn Код:
if(classid == 2 && PlayerInfo[playerid][pFaction] == 1)
{
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        // Your codes
} else SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
It shows the fuck you but I can spawn.
Reply
#6

You need to use the OnPlayerRequestSpawn(playerid) callback.

pawn Код:
new FuckerTeamClass[MAX_PLAYERS];
new FuckerTeam[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 1)
    {
        FuckerTeamClass[playerid] = 0;
        FuckerTeam[playerid] = 0;
    }
    if(classid == 2 && PlayerInfo[playerid][pFaction] == 1)
    {
        GameTextForPlayer(playerid, "~r~ Fucker Team", 9999999, 6);
        FuckerTeamClass[playerid] = 0;
        FuckerTeam[playerid] = 0;
    }
    if(classid == 2 && PlayerInfo[playerid][pFaction] == 0)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Fuck you, you aren't registered on fucker team.");
        FuckerTeamClass[playerid] = 1;
        FuckerTeam[playerid] = 1;
    }
    if(classid == 3)
    {
        FuckerTeamClass[playerid] = 0;
        FuckerTeam[playerid] = 0;
    }
}

public OnPlayerRequestSpawn(playerid)
{
    if(FuckerTeamClass[playerid] == 1 && FuckerTeam[playerid] == 1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Sir, you cannot spawn.");
        return 0;
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerRequestSpawn

The wiki seems to have a bug? It says public OnPlayerRequestClass(playerid) lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)