[ help ] some commands only work with id 0
#1


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;
	}
Reply
#2

i think because you use "giveplayerid" and this is 0 probably change it to playerid
Reply
#3

no [playerid] is the player using the command. [giveplayerid] is the person your giving the command to. and if your target is id 0 it still checks your team and if your jacked in.. bla bla.... but it works with id 0 if that helps lol
Reply
#4

you haven't setted giveplayerid

as i see
Reply
#5

Learn/Search how to use strtok.
Reply
#6

Instead ive learned to check my shit before i post and that especially when you just got done smoking some weed... whahah

I cant believe i even made this post, i was sooo stoned. I fixed it a LONG time ago. wow. I still amaze myself
Reply
#7

Quote:
Originally Posted by [INF
Interceptor ]
Instead ive learned to check my shit before i post and that especially when you just got done smoking some weed... whahah

I cant believe i even made this post, i was sooo stoned. I fixed it a LONG time ago. wow. I still amaze myself
Well lay off the joints and take a look at the dates of these old threads you're bumping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)