SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 11/08/2014, 11:20 AM   #1
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default please help

How i can make the FBI do /megaphone (( /m ))
i have this code but they cant

pawn Code:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new type = FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
            new tmpcar = GetPlayerVehicleID(playerid);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/m)egaphone [megaphone chat]");
                return 1;
            }
            if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4|| IsASoldier(playerid))
            {

                if(!IsACopCar(tmpcar) && !IsAFBICar(tmpcar) && !IsAnAmbulance(tmpcar) && !IsANGCar(tmpcar))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "   You are not in a Government vehicle !");
                    return 1;
                }
                else if(IsACop(playerid))
                {
                    format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
                    ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(type == 2)
                {
                    format(string, sizeof(string), "[Agent %s:o< %s]", sendername, result);
                    ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(IsAMedic(playerid))
                {
                    format(string, sizeof(string), "[Doctor %s:o< %s]", sendername, result);
                    ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
                else if(IsASoldier(playerid))
                {
                    format(string, sizeof(string), "[Soldier %s:o< %s]", sendername, result);
                    ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You are not part of a Faction !");
                return 1;
            }
        }
        return 1;
    }
salev13 is offline   Reply With Quote
Old 11/08/2014, 11:26 AM   #2
alanhutch
Huge Clucker
 
alanhutch's Avatar
 
Join Date: Nov 2010
Location: Florence, Italy. Reputation: 9999
Posts: 363
Reputation: 8
Default Re: please help

What pMember ID is FBI?
alanhutch is offline   Reply With Quote
Old 11/08/2014, 11:50 AM   #3
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: please help

Quote:
Originally Posted by alanhutch View Post
What pMember ID is FBI?
if i dont work 2

but how to check for be sure?
salev13 is offline   Reply With Quote
Old 11/08/2014, 12:06 PM   #4
SKAzini
Huge Clucker
 
SKAzini's Avatar
 
Join Date: Jun 2012
Posts: 376
Reputation: 17
Default Re: please help

Quote:
Originally Posted by salev13 View Post
but how to check for be sure?
pawn Code:
//in console:
printf("%d", PlayerInfo[playerid][pMember]);
//or ingame:
new membID[1];
format(membID, sizeof membID, "%d", PlayerInfo[playerid][pMember]);
SendClientMessage(playerid, -1, membID);

before

pawn Code:
new type = FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
SKAzini is offline   Reply With Quote
Old 11/08/2014, 12:24 PM   #5
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: please help

Quote:
Originally Posted by SKAzini View Post
pawn Code:
//in console:
printf("%d", PlayerInfo[playerid][pMember]);
//or ingame:
new membID[1];
format(membID, sizeof membID, "%d", PlayerInfo[playerid][pMember]);
SendClientMessage(playerid, -1, membID);

before

pawn Code:
new type = FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
pawn Code:
stock IsAnAgent(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        /*new leader = PlayerInfo[playerid][pLeader];
        new member = PlayerInfo[playerid][pMember];
        if(member == 2) return 1;
        else if(leader == 2) return 1;*/

        new type = FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
        if(type == 2) return 1;
    }
    return 0;
}
salev13 is offline   Reply With Quote
Old 11/08/2014, 02:13 PM   #6
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: please help

??
salev13 is offline   Reply With Quote
Reply

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



All times are GMT. The time now is 05:01 PM.


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