21.03.2009, 22:51
i looked at some previous posts but did not help me. is there any reason anywhere in this code that you can see that would make it work ONLY on id 0
Код:
if(strcmp(cmd,"/switch", true) == 0)
{
if(gTeam[playerid] != TEAM_AGENT) {
SendClientMessage(playerid, COLOR_ERROR, "You are not an Agent. You cannot use this command.");
return 1;
}
if(SwitchedRecent[playerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "Switched recently, please wait.");
return 1;
}
if(gTeam[giveplayerid] == TEAM_FREEMIND) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use /switch on a freemind.");
return 1;
}
if(gTeam[giveplayerid] == TEAM_SMITH) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use /switch on Agent Smith.");
return 1;
}
if(gTeam[giveplayerid] == TEAM_AGENT) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use /switch with this player.");
return 1;
}
if(gTeam[giveplayerid] == TEAM_NEO) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use /switch with this player.");
return 1;
}
if(Deleted[giveplayerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "This program does not exist or has been deleted. Switch Failed.");
return 1;
}
if(JackedIn[giveplayerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "This person is not jacked in to the Matrix. Switch Failed.");
return 1;
}
if(!cmdtext[7] || !('0' <= cmdtext[8] <= '9'))
return SendClientMessage(playerid, 0xFFFFFFAA, "Right Usage: /switch [playerid]");
{
new Float:Pos[6], id = strval(cmdtext[8]), string[60];
GetPlayerPos(id, Pos[3], Pos[4], Pos[5]);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof string, "%s(%d) has switched places with you!", string, playerid);
SendClientMessage(id, 0xFF0000AA, string);
GetPlayerName(id, string, MAX_PLAYER_NAME);
format(string, sizeof string, "You have switched places with %s(%d)!", string, id);
SendClientMessage(playerid, 0xFF0000AA, string);
SetPlayerPos(playerid, Pos[3], Pos[4], Pos[5]);
SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
GetPlayerName(id,string, MAX_PLAYER_NAME);
format(string, sizeof(string), "An Agent Has used /switch",playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SetTimer("switchedrecenttimer",60000,1);
SwitchedRecent[playerid] =1;
}
return 1;
}

