SA-MP Forums Archive
how do i disable this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how do i disable this? (/showthread.php?tid=335826)



how do i disable this? - TheMightyEddy - 19.04.2012

I have a /hits script. This code will show the current hits:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(hit, 3, cmdtext);

    if(!strcmp(cmdtext, "/hits", true))
    {
        new count = 0;
        SendClientMessage(playerid, COLOR_MSG, "Current Hits:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && hit[i] > 0)
            {
                new string[256];
                format(string, 256, "%s (%i) for $%i", ReturnPlayerName(i), i, hit[i]);
                SendClientMessage(playerid, COLOR_FOUND, string);
                count++;
            }
        }
        if(count == 0)
        {
            SendClientMessage(playerid, COLOR_ERROR, "No Hits Placed At This Time.");
    }
        return 1;
}

    return 0;
    }
My gTeam is "Team_Cop" without quotes. I want it so when gTeam == Team_Cop, it will SendClientMessage "You are a cop. You cannot see the hits!" Also, this is not in my gamemode. It's a filterscript so how can i define Team_Cop? +REP


Re: how do i disable this? - zSuYaNw - 20.04.2012

you can use:

pawn Код:
if(gTeam[playerid] == Team_Cop) // check' is player a coop.
    return SendClientMessage(playerid, -1,"You are a cop you cannot see the hits");



Re: how do i disable this? - TheMightyEddy - 20.04.2012

Yes thanks. That's what I did but it says Team_Cop is not defined. How can I define it from my gamemode?


Re: how do i disable this? - zSuYaNw - 20.04.2012

Define in top of gamemode
pawn Код:
#define Team_Cop     (20)
// More team in here



Re: how do i disable this? - TheMightyEddy - 20.04.2012

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
Define in top of gamemode
pawn Код:
#define Team_Cop     (20)
// More team in here
No sorry I mean the "hits" is a filterscript. So how can I define gTeam and Team_Cop in my filterscript and link it to my GM so my GM and filterscript is compatible?


Re: how do i disable this? - zSuYaNw - 20.04.2012

pawn Код:
// InFilterScript
new team[MAX_PLAYERS];
getTeam(p,value); public getTeam(p,value)
{
    team[p] = value;
    return 1;
}

if(team[playerid] == Team_Cops)
{

}


// InOnPlayerSpawn (GAMEMODE)
CallRemoteFunction("getTeam", "ii", playerid, gTeam[playerid]);



Re: how do i disable this? - TheMightyEddy - 20.04.2012

Thanks but here is the error:

Код:
error 010: invalid function or declaration
Here is the line that has the error:

Код:
if(team[playerid] == Team_Cops)