Problem
#1

guys look at this codes

if(!strcmp(cmdtext, "/home", true))
{
if(GetPlayerTeam(playerid == TEAM_GROVE))
{
new pName[MAX_PLAYER_NAME], Message[128];
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2524.9407, -1677.6975, 19.9302);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(Message, sizeof(Message), "%s (%d) Has Returned To Their Home (/home)!", pName, playerid), SendClientMessageToAll(0xF2B40AFF, Message);
}
if(GetPlayerTeam(playerid == TEAM_BALLAS))
{
new pName[MAX_PLAYER_NAME], Message[128];
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2175.4119, -1667.8252, 15.0859);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(Message, sizeof(Message), "%s (%d) Has Returned To Their Home (/home)!", pName, playerid), SendClientMessageToAll(0xF2B40AFF, Message);
}
if(GetPlayerTeam(playerid == TEAM_VAGOS))
{
new pName[MAX_PLAYER_NAME], Message[128];
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2216.5562, -1179.6378, 29.7971);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(Message, sizeof(Message), "%s (%d) Has Returned To Their Home (/home)!", pName, playerid), SendClientMessageToAll(0xF2B40AFF, Message);
}
if(GetPlayerTeam(playerid == TEAM_LSPD))
{
new pName[MAX_PLAYER_NAME], Message[128];
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1552.7341, -1675.6779, 16.1953);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(Message, sizeof(Message), "%s (%d) Has Returned To Their Home (/home)!", pName, playerid), SendClientMessageToAll(0xF2B40AFF, Message);
return 1;
}
if(GetPlayerTeam(playerid == TEAM_AZTECAS))
{
new pName[MAX_PLAYER_NAME], Message[128];
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1754.6223,-1912.3051,13.5681);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(Message, sizeof(Message), "%s (%d) Has Returned To Their Home (/home)!", pName, playerid), SendClientMessageToAll(0xF2B40AFF, Message);
}
return 1;
}
return 0;
}

When i try to use /home it makes any player go to TEAM_GROVE Spawn (2524.9407, -1677.6975, 19.9302),And i want each player in each team do /home in each place but i cant so i need help
Reply
#2

that's because you check is playerid equals team id, but not player team id. You have:
pawn Код:
if(GetPlayerTeam(playerid == TEAM_GROVE))
Which should be:
pawn Код:
if(GetPlayerTeam(playerid) == TEAM_GROVE)
Reply
#3

Does this even compile? Your statements are completely wrong.

pawn Код:
if(GetPlayerTeam(playerid) == TEAM_GROVE)
But it might be better to use a switch instead.

pawn Код:
switch(GetPlayerTeam(playerid))
{
    case TEAM_GROVE: {}
    case TEAM_BALLAS: {}
    // etc.
}
Sidenote: Try not to repeat code. The message is going to be sent regardless of which team they're actually in, making the statement it itself redundant.
Reply
#4

Scottas,Thank You Very much,i will give you a rep and it worked for me very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)