[UNSOLVED] Pilot chat?
#1

Hey i want to make a chat only works for players that are in a heli/plane. Heres my code so far:
Код:
public OnPlayerText(playerid, text[])
{
  if(text[0] == '&' {
	  new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"Pilot Chat: %s: %s",string,text[1]); SendClientMessageToAll(green,string);
	  return 1;
  }
	return 1;
}
When i compile i get this error on the
Код:
 if(text[0] == '&' {
line.
Код:
C:\Documents and Settings\Administratцr\Skrivbord\Server\gamemodes\nwa.pwn(593) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please also help me to only make it work for people in plane/heli.
Reply
#2

if(text[0] == '&') {
Reply
#3

Quote:
Originally Posted by FUNExtreme
if(text[0] == '&') {
Thanks I can compile now and i can use pilot chat ingame. But the problem is that all can use it even if they are not in a heli/plane. Does anyone know how to only get it working for those who are in heli/plane, Please
Thanks in advance, your homie ~Bajskorv

EDIT: When i went into game to try it, i also saw this error, when i write like &hello all pilots, it writes that as usual and says it in pilot chat without the &. Ill post pic so you know what i mean.

I wanna remove the usual chat for that so you only can see in pilot like private chat but with pilots. You know what i mean? Please post here, Please
Thanks in advanca again , your homie ~Bajskorv
Reply
#4

https://sampwiki.blast.hk/wiki/GetVehicleModel

Just put the vehicle model ID's for Helis/planes.

Like

pawn Код:
new vehicleid;

for (new i = 0; i < MAX_PLAYERS; i++)
{
vehicleid = GetPlayerVehicleID(i);
if(GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 469){
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Pilot Chat: %s: %s",string,text[1]); SendClientMessageToAll(green,string);
}
return 1;
You can add more by doing this in the check;
pawn Код:
|| GetVehicleModel(vehicleid) == Model ID || GetVehicleModel(vehicleid) == Model ID
Make sure It's ){ in the end just like the example.
Reply
#5

Also use return 0 instead of return 1 if you don't want to see the message in normal chat.
Reply
#6

That makes no sense.
Reply
#7

When i try to add this:
Код:
7public OnPlayerText(playerid, text[])
8{
9  if(text[0] == '&') {
10	  new pName[128];
11	  new string[128];
12		GetPlayerName(playerid,pName,sizeof(string));
13		vehicleid = GetPlayerVehicleID(playerid);
14        if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 || GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 || GetVehicleModel(vehicleid) == 464 || GetVehicleModel(vehicleid) == 465 || GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 || GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 || GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 501 || GetVehicleModel(vehicleid) == 511 || GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 || GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 || GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 || GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593 || GetVehicleModel(vehicleid) == 488){
15		format(string,sizeof(string),"Pilot Chat: %s: %s",pName,text[1]);
16		SendClientMessageToAll(green,string);
17		return 1;
18		} else {
19		SendClientMessage(playerid,green,"You must be in a plane or heli to use pilot chat");
20		return 1;
21		}
22	return 1;
23}
I get these errors:
Код:
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(13) : error 075: input line too long (after substitutions)
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(14) : error 017: undefined symbol "ve"
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(15) : error 017: undefined symbol "hicleid"
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(15) : warning 217: loose indentation
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(15) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(15) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administratцr\Skrivbord\Server\filterscripts\pilot.pwn(15) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#8

You have to use the loop trough all players, and don't use SendClientMessageToAll to have it being sent to pilots only.

And you can't remove new vehicleid; as It would make it undefined. You must also use GetPlayerVehicleID(i); to use the loop.
Reply
#9

Cant you just, Please , make it done for me?
Heres the, whatever you know.
Код:
if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 || GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 || GetVehicleModel(vehicleid) == 464 || GetVehicleModel(vehicleid) == 465 || GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 || GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 || GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 501 || GetVehicleModel(vehicleid) == 511 || GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 || GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 || GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 || GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593 || GetVehicleModel(vehicleid) == 488){
Reply
#10

Quote:
Originally Posted by bajskorv123
Cant you just, Please , make it done for me?
Heres the, whatever you know.
Код:
if(GetVehicleModel(vehicleid) == 417 || GetVehicleModel(vehicleid) == 425 || GetVehicleModel(vehicleid) == 447 || GetVehicleModel(vehicleid) == 460 || GetVehicleModel(vehicleid) == 464 || GetVehicleModel(vehicleid) == 465 || GetVehicleModel(vehicleid) == 469 || GetVehicleModel(vehicleid) == 476 || GetVehicleModel(vehicleid) == 487 || GetVehicleModel(vehicleid) == 488 || GetVehicleModel(vehicleid) == 497 || GetVehicleModel(vehicleid) == 501 || GetVehicleModel(vehicleid) == 511 || GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 513 || GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 548 || GetVehicleModel(vehicleid) == 553 || GetVehicleModel(vehicleid) == 563 || GetVehicleModel(vehicleid) == 577 || GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 593 || GetVehicleModel(vehicleid) == 488){
I have such code, but with a /p command. but I'll not give It to you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)