SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 22/01/2010, 12:10 PM   #1
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default [SOLVED]OnPlayerText Question

My code:
pawn Code:
if(text[0] == '!')
{
    new string[128];  GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), ">>>Megaphone [%s]: >>%s!!!", string, text[1]);
    printf("%s", string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    if(GetDistanceBetweenPlayers(playerid, i) < 7.0)
    {
    SendClientMessage(i, COLOR_YELLOW, string);
    }
    }
    }
return 0;
}

How would i make that,
So you can only use it, If your a cop, And only if your in a cop car

pawn Code:
if(IsACopCar(vehicleid);

How would i do that?
Because i tried, But it dosent let me use the command if im in a copcar,
But it does if im not in one,
Because it just showed

!Test

In the chatbox
JoeDaDude is offline  
Old 22/01/2010, 01:36 PM   #2
¤Adas¤
Gangsta
 
¤Adas¤'s Avatar
 
Join Date: Jan 2010
Posts: 549
Reputation: 26
Default Re: OnPlayerText Question

Put there something like:
pawn Code:
if(!IsPlayerCop(playerid) || !IsCopCar(GetPlayerVehicleID(playerid)) return SendClientMessage(...);
¤Adas¤ is offline  
Old 22/01/2010, 01:37 PM   #3
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Re: OnPlayerText Question

Ok i will try
JoeDaDude is offline  
Old 22/01/2010, 01:50 PM   #4
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Re: OnPlayerText Question

Ok it works, Now another thing,
When it stops the megaphone from doing anything,
And says im not a cop and/or not in a cop car,
But if i type !Test it will say it,
But also say !Test in the chatbox,
How to stop that,
So it just ses im not a cop/andor not in a cop car

EDIT: Oh and if i am in a cop car, It still says im not,
Might be a Team problem,
But if it is, I only have one team so far,
But it shouldnt be because im using a command,
Any ideas, If ui need showing more code, Ask
JoeDaDude is offline  
Old 22/01/2010, 02:00 PM   #5
Striker_Moe
Gangsta
 
Join Date: Apr 2009
Posts: 569
Reputation: 1
Default Re: OnPlayerText Question

You should add this:
pawn Code:
if(!IsPlayerCop(playerid) || !IsCopCar(GetPlayerVehicleID(playerid))
{
SendClientMessage(...)
return 0;
}
instead of
pawn Code:
if(!IsPlayerCop(playerid) || !IsCopCar(GetPlayerVehicleID(playerid)) return SendClientMessage(...);
Striker_Moe is offline  
Old 22/01/2010, 02:03 PM   #6
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 6
Default Re: OnPlayerText Question

Dosent fix my problem though,

Im on the right team, And in a copcar,
Yet it still says i am not?
Why is that?
Also how to stop this so when i type

!Test

It says,

You arent a cop and/or arent in a cop car

But in the chatbox

It also says

Torran: !Test

How to stop it from saying that

The !Test bit
JoeDaDude 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
[SOLVED]Simple question[SOLVED] park4bmx Help Archive 2 16/06/2010 04:24 PM
OnPlayerText question Torran Help Archive 3 24/02/2010 04:03 PM
question about using new [SOLVED] [SF]RobMob Help Archive 5 11/02/2010 08:52 PM
[SOLVED]A question TyreXel Help Archive 1 18/12/2009 03:01 PM


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


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