Command failure?
#6

GUYS PLEASE STOP TELLING BULLSHIT, ups caps

SetPlayerCheckpoint only returns 1 if the checkpoint was created and 0 for not
IsPlayerInCheckpoint only checks if the player is in the checkpoint (and only one at the same time can exist)

Topic:
You got a bracket problem and the class thing wont work because you create the variable classid local (and never change it) so it is always zero

Use gTeam, the native team functions or the new pVars

Here an example with pVars (because I like friendly fire - the native function disable it )
pawn Код:
//These macros will overwrite the existing native functions!
#define SetPlayerTeam(%0,%1) SetPVarInt(%2, "TEAM_VAR", %1)
#define GetPlayerTeam(%0) GetPVarInt(%0, "TEAM_VAR")
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0..2: SetPlayerTeam(playerid, 1); //Team 1
        case 3..5: SetPlayerTeam(playerid, 2); //Team 2
    }
}
pawn Код:
//OnPlayerCommandText
    if(!strcmp(cmdtext,"/arm",true))
    {
        if(IsPlayerInCheckpoint(playerid))
        {
            if(GetPlayerTeam(playerid) == 1)
            {
                SendClientMessageToAll(COLOR_GREEN,"Team 1 has planted their bomb!");
            } else { //if he isnt in team 1 he must be in team 2
                SendClientMessageToAll(COLOR_GREEN,"Team 2 has planted their bomb!");
            }
        } else {
            SendClientMessage(playerid,COLOR_RED,"Your Not in the checkpoint!");
        }
        return 1;
    }
Reply


Messages In This Thread
Command failure? - by -Rebel Son- - 27.05.2010, 00:03
Re: Command failure? - by coole210 - 27.05.2010, 00:07
Re: Command failure? - by -Rebel Son- - 27.05.2010, 00:18
Re: Command failure? - by Toni - 27.05.2010, 00:22
Re: Command failure? - by -Rebel Son- - 27.05.2010, 00:29
Re: Command failure? - by Nero_3D - 27.05.2010, 01:08
Re: Command failure? - by -Rebel Son- - 27.05.2010, 01:14
Re: Command failure? - by Nero_3D - 27.05.2010, 01:27
Re: Command failure? - by -Rebel Son- - 27.05.2010, 01:39
Re: Command failure? - by Nero_3D - 27.05.2010, 02:28

Forum Jump:


Users browsing this thread: 1 Guest(s)