Command Problem
#1

I have 3 commands:
/enterpd, /exitpd - for police department
/entermotel, /exitmotel - for jefferson motel
/enterclub, /exitclub - for a club

and there in this order:
Код:
if(strcmp(cmdtext, "/enterpd", true, 6) == 0)
	{
		if(PlayerToPoint(3, playerid, 1553.6312,-1674.9126,16.1953)) // Police enterance
		{
		  SetPlayerInterior(playerid, 6); // This is important! This sets player to interior id 3!
		  SetPlayerPos(playerid, 246.5443,64.0745,1003.6406); // these are coordinates where he'll spawn (PD INT)
		  return 1;
		}
		return 1;
    }

	if (strcmp(cmdtext, "/exitpd", true, 5) == 0)
		{
      if(PlayerToPoint(3, playerid, 246.5443,64.0745,1003.6406)) // Police enterance
	  {
	    SetPlayerInterior(playerid, 0); // this is important..interior 0 is outside...
	    SetPlayerPos(playerid, 1553.6312,-1674.9126,16.1953); // this is where player will stand...
	    return 1;
	  }
			return 1;
		}

	if(strcmp(cmdtext, "/entermotel", true, 6) == 0)
	{
		if(PlayerToPoint(3, playerid, 2231.9150,-1159.6749,25.8906)) // jefferson
		{
		  SetPlayerInterior(playerid, 15); // This is important! This sets player to interior id 3!
		  SetPlayerPos(playerid, 2216.3401,-1150.5100,1025.7969); // these are coordinates where he'll spawn (PD INT)
		  return 1;
		}
		return 1;
    }

	if (strcmp(cmdtext, "/exitmotel", true, 5) == 0)
		{
      if(PlayerToPoint(3, playerid, 2216.3401,-1150.5100,1025.7969)) // jefferson
	  {
	    SetPlayerInterior(playerid, 0); // this is important..interior 0 is outside...
	    SetPlayerPos(playerid, 2231.9150,-1159.6749,25.8906); // this is where player will stand...
	    return 1;
	  }
			return 1;
		}

	if(strcmp(cmdtext, "/enterclub", true, 6) == 0)
	{
		if(PlayerToPoint(3, playerid, 815.9653,-1386.4366,13.6064)) // club n1ne
		{
		  SetPlayerInterior(playerid, 17); // This is important! This sets player to interior id 3!
		  SetPlayerPos(playerid, 493.4612,-23.7310,1000.6797); // these are coordinates where he'll spawn (PD INT)
		  return 1;
		}
		return 1;
    }
	if (strcmp(cmdtext, "/exitclub", true, 5) == 0)
		{
      if(PlayerToPoint(3, playerid, 493.4612,-23.7310,1000.6797)) // club n1ne
	  {
	    SetPlayerInterior(playerid, 0); // this is important..interior 0 is outside...
	    SetPlayerPos(playerid, 815.9653,-1386.4366,13.6064); // this is where player will stand...
	    return 1;
	  }
      return 1;
		}
and only /enterpd and /exitpd work. Can you tell me whats wrong?
Reply
#2

Are the coords not in the right order? And take off the length part on strcmp. They are all wrong and you don't need them anyway unless you were doing like params or something.

pawn Код:
if (strcmp(cmdtext, "/exitmotel", true, 5) == 0)
Should be.

pawn Код:
if (strcmp(cmdtext, "/exitmotel", true) == 0)
Reply
#3

aight, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)