SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 24/02/2010, 03:06 PM   #1
Torran
High-roller
 
Join Date: Jan 2010
Posts: 1,779
Reputation: 1
Default OnPlayerText question

pawn Code:
public OnPlayerText(playerid, text[])
{
    if(CallEmergency[playerid] == 1)
    {
    if(!strcmp("police", text, true))
    {
    CallEmergency[playerid] = 0;
    PoliceSelect[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    else if(!strcmp("paramedic", text, true))
    {
    CallEmergency[playerid] = 0;
    ParamedicSelect[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    }
    else if(PoliceSelect[playerid] == 1)
    {
    PoliceSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_POLICE, COLOR_ORANGE, string);
    }
    else if(ParamedicSelect[playerid] == 1)
    {
    ParamedicSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_MEDIC, COLOR_ORANGE, string);
    }
    return 0;
}

Now you cant say anything except that in the code above, But thats only if you say /911,
So how can i make it return 0; on them things but return 1; on onplayertext itself
Torran is offline  
Old 24/02/2010, 03:49 PM   #2
VonLeeuwen
Big Clucker
 
Join Date: Oct 2007
Posts: 196
Reputation: 0
Default Re: OnPlayerText question

http://pawn.pastebin.com/0pkNyT2F

Try that
VonLeeuwen is offline  
Old 24/02/2010, 04:00 PM   #3
Torran
High-roller
 
Join Date: Jan 2010
Posts: 1,779
Reputation: 1
Default Re: OnPlayerText question

I still cant talk
Torran is offline  
Old 24/02/2010, 04:03 PM   #4
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: OnPlayerText question

Proper Indentation can go a long way.
pawn Code:
public OnPlayerText(playerid, text[])
{
  if(CallEmergency[playerid] == 1)
  {
    if(!strcmp("police", text, true))
    {
      CallEmergency[playerid] = 0;
      PoliceSelect[playerid] = 1;
      SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    else if(!strcmp("paramedic", text, true))
    {
      CallEmergency[playerid] = 0;
      ParamedicSelect[playerid] = 1;
      SendClientMessage(playerid, COLOR_RED, "Please type in your situtation, Remember to include your location");
    }
    return 0;
  }
  else if(PoliceSelect[playerid] == 1)
  {
    PoliceSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_POLICE, COLOR_ORANGE, string);
    return 0;
  }
  else if(ParamedicSelect[playerid] == 1)
  {
    ParamedicSelect[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    new string[300];
    GetPlayerName(playerid, name, sizeof(name));
    SendClientMessage(playerid, COLOR_RED, "Your message has been confirmed and sent, Thankyou");
    format(string, sizeof(string), "911 Call: (%s) %s", name, text);
    SendTeamMessage(TEAM_MEDIC, COLOR_ORANGE, string);
    return 0;
  }
  return 1;
}
Joe Staff is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnPlayerText [HELP] Jay. Help Archive 3 23/05/2010 10:44 AM
Help with OnPlayerText jacobv Help Archive 1 24/03/2010 05:28 PM
[SOLVED]OnPlayerText Question JoeDaDude Help Archive 5 22/01/2010 02:03 PM
OnPlayerText _Sami_ Help Archive 5 08/12/2009 03:31 PM


All times are GMT. The time now is 11:30 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.