20.12.2018, 18:03
Quote:
Does it mean that I should not use 'SetPlayerTeam' for each team?
This is what I have in my script, is it wrong?: |
Just put these 5 lines in an include files and include it or put them before the first SetPlayerTeam / GetPlayerTeam in your code
This code simply defines SetPlayerFaction and GetPlayerFaction, nothing more nothing less
PHP Code:
native SetPlayerFaction(playerid, Faction: factionid) = SetPlayerTeam;
native Faction: GetPlayerFaction(playerid) = GetPlayerTeam;
new gTeam[MAX_PLAYERS];
#define SetPlayerTeam(%0,%1) (gTeam[%0] = %1)
#define GetPlayerTeam(%0) gTeam[%0]
PHP Code:
// somewhere before your first usage
enum Faction {
Faction_Defend, // President, Police
Faction_Attack // Terrorist
};
//OnDialogResponse
case Dialog_PTP:
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerFaction(playerid, Faction_Defend);
SetPlayerTeam(playerid, Team_President);
//other codes
}
case 1:
{
SetPlayerFaction(playerid, Faction_Defend);
SetPlayerTeam(playerid, Team_Police);
//other codes
}
case 2:
{
SetPlayerFaction(playerid, Faction_Attack);
SetPlayerTeam(playerid, Team_Terrorist);
//other codes
}
}
}
return 1;
}