[SOLVED]OnPlayerText Question
#1

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
Reply
#2

Put there something like:
pawn Code:
if(!IsPlayerCop(playerid) || !IsCopCar(GetPlayerVehicleID(playerid)) return SendClientMessage(...);
Reply
#3

Ok i will try
Reply
#4

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
Reply
#5

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(...);
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)