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