Another Multiple command help request.
#1

I know people have already posted help requests regarding this, however mine isn't quite the problem of not knowing how to add multiple commands but that they dont work lol. I have looked at another script and forum posts on here already and my script looks the same when it comes to multiple commands.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
  
  if(strcmp(cmd, "/pass1", true) == 0)
	{
	  SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are now a civilian.");
	  SetPlayerColor(playerid,COLOR_GREY);
	  new playername[MAX_PLAYER_NAME];
	  GetPlayerName(playerid,playername,sizeof(playername));
		ResetPlayerWeapons(playerid);
		SetPlayerArmour(playerid,0);
	  LockAllVehicles(playerid);
	  SetPlayerTeam(playerid,8);
	  gteam[playerid] = Team_CIVILIAN;
	  SetPlayerTeam(playerid,Team_CIVILIAN);
  	return 1;
 	}
	
 	if(strcmp(cmd, "/pass2", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are now on duty as a Fort Carson Police Officer.");
		SetPlayerSkin( playerid, 282 );
		UnlockPOLICECars(playerid);
		return 1;
 	}
	
	if(strcmp(cmd, "/pass3", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are now on duty as a Fort Carson Paramedic.");
		SetPlayerSkin( playerid, 282 );
		UnLockMEDICCars(playerid);
		return 1;
 	}
	
	if(strcmp(cmd, "/pass4", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are logged in as a Gang Member.");
		SetPlayerSkin( playerid, 282 );
		UnLockGANGCars(playerid);
		return 1;
 	}
	
	if(strcmp(cmd, "/pass5", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are logged in as a Taxi Driver.");
		SetPlayerSkin( playerid, 282 );
		UnLockTAXICars(playerid);
		return 1;
	}
	
	if(strcmp(cmd, "/pass6", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are logged in as a News Reporter.");
		SetPlayerSkin( playerid, 282 );
		UnLockNEWSCars(playerid);
		return 1;
 	}
	
	if(strcmp(cmd, "/pass7", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are logged in as an Ice Cream Distributor.");
		SetPlayerSkin( playerid, 282 );
		UnLockICECREAMCars(playerid);
		return 1;
 	}

	if(strcmp(cmd, "/pass8", true) == 0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You are logged in as a Fort Carson Bus Driver.");
		SetPlayerSkin( playerid, 282 );
		UnLockBUSCars(playerid);
		return 1;
 	}
	return 0;
}
Whenever I use the commands the only one that actually works is the /pass1 command (I get no error messages when scripting though)
I appreciate any help anyone can give.
Reply
#2

It's cmdtext not cmd... you actually create an empty array and compare it with strings
Reply
#3

cheers my bad, script I looked at uses a combo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)