ZCMD: LSPD Hotline ( /call 199 ) [+REP]
#3

something like this, not perfect, not tested may contain errors, as i made it here in this little box x:, anyways, this is just an example.
pawn Код:
new help, helped; //this will be declared as a global var


CMD:call(playerid, params)
{
    if(IsCop) return SendClientMessage(playerid, -1 , "You are a cop, why do you wanna call yourself?"); // replace IsCop with your cop variable if you want that cops cannot use this command.
    new pname[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    for(new i; i>=MAX_PLAYERS;i++)
    {
        if(IsCop) //IsCop = your variable for cops and use "i" instead of playerid
        {
            format(str, sizeof(str), "%s has requested help!" pname);
            GameTextForPlayer(i, str);
            SendClientMessage(i, -1, str);
            help=1;
            helped=0;
        }
    }
    return 1;
}
CMD:answer(playerid, params)
{
    if(!IsCop) return SendClientMessage(playerid, -1 , "You not a cop."); // !IsCop = the players who are not cops, example, if your var is "PlayerInfo[playerid][cop]" then this should be "PlayerInfo[playerid][cop] == 0"
    if(helped == 1) return SendClientMessage(playerid , -1 , "Already helped!"// checking if someone already took the call
    if(help == 0) return SendClientMessage(playerid , -1 , "Nobody Called for help!"// checking if someone has actually requested for help
    new pname[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, pname, sizeof(pname));
   
    for(new i; i>=MAX_PLAYERS;i++)
    {
        if(IsCop) //IsCop = your variable for cops and use "i" instead of playerid
        {
            format(str, sizeof(str), "%s has taken the call!" pname);
            SendClientMessage(i, -1, str);
            helped = 1;
            help = 0;
        }
    }
   
    return 1;
}
Reply


Messages In This Thread
ZCMD: LSPD Hotline ( /call 199 ) [+REP] - by Aira - 07.04.2012, 15:24
Re: ZCMD: LSPD Hotline ( /call 199 ) [+REP] - by JhnzRep - 07.04.2012, 15:28
Re: ZCMD: LSPD Hotline ( /call 199 ) [+REP] - by emokidx - 07.04.2012, 15:42
Re: ZCMD: LSPD Hotline ( /call 199 ) [+REP] - by Aira - 07.04.2012, 16:45

Forum Jump:


Users browsing this thread: 1 Guest(s)