SA-MP Forums Archive
How to make a ERROR Message? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make a ERROR Message? (/showthread.php?tid=517515)



How to make a ERROR Message? - [Cali]ChrOnic_T - 05.06.2014

How can I make it say "You must be on foot to use this command"


on this CMD:


pawn Код:
CMD:mission(playerid,params[])
{
if(IsPlayerSpawned(playerid))
{
  TextDrawShowForPlayer(playerid,mission);
  TextDrawShowForPlayer(playerid,mission1);
  TextDrawShowForPlayer(playerid,mission2);
  return 1;
}
//SendClientMessage(playerid,0xFF1A00C8,"You must be on foot to use this command"); This here



Re: How to make a ERROR Message? - TheSimpleGuy - 05.06.2014

pawn Код:
if(IsPlayerSpawned(playerid))
{
  TextDrawShowForPlayer(playerid,mission);
  TextDrawShowForPlayer(playerid,mission1);
  TextDrawShowForPlayer(playerid,mission2);
  return 1;
}
else
{
//code



Re: How to make a ERROR Message? - PrivatioBoni - 05.06.2014

pawn Код:
new playerState = GetPlayerState(playerid);
 
if (playerState != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_RED, "Error: You must be on foot to use this command.");



Re: How to make a ERROR Message? - AIped - 05.06.2014

EDIT: do the playerstate part as PrivatioBoni showed
pawn Код:
CMD:mission(playerid,params[])
{
new playerState = GetPlayerState(playerid);
 
if (playerState != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_RED, "Error: You must be on foot to use this command.");
  else
  {
  if(IsPlayerSpawned(playerid))
  {
    TextDrawShowForPlayer(playerid,mission);
    TextDrawShowForPlayer(playerid,mission1);
    TextDrawShowForPlayer(playerid,mission2);
 
  }
return 1;
}



Re: How to make a ERROR Message? - Rittik - 05.06.2014

Код:
CMD:mission(playerid,params[])
{
if(IsPlayerSpawned(playerid)&&GetPlayerState(playerid)==PLAYER_STATE_ONFOOT)
{ 
  TextDrawShowForPlayer(playerid,mission);
  TextDrawShowForPlayer(playerid,mission1);
  TextDrawShowForPlayer(playerid,mission2);

}
else
{
SendClientMessage(playerid,0xFF1A00C8,"You must be on foot to use this command");
return 1;
}
 return 1;
}



Re: How to make a ERROR Message? - PrivatioBoni - 05.06.2014

Dunno why everyone's code is so messy. This is the cleanest I can do:

pawn Код:
CMD:mission(playerid,params[])
{
   new playerState = GetPlayerState(playerid);  
   if (playerState != PLAYER_STATE_ONFOOT)
   {
      SendClientMessage(playerid, COLOR_RED, "Error: You must be on foot to use this command.");
      return 1;
   }




   TextDrawShowForPlayer(playerid,mission);
   TextDrawShowForPlayer(playerid,mission1);
   TextDrawShowForPlayer(playerid,mission2);
 
   return 1;
}