SA-MP Forums Archive
help with cell phone cmds!! - 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: help with cell phone cmds!! (/showthread.php?tid=281778)



help with cell phone cmds!! - ahmed2793 - 07.09.2011

im really new to scripting and im using satdm as gamemode the thing is the celpphone system in gamemode don't show what people say to admins not like pm and im facing some problems with this some people come and they use advertise with the cellphone cmds i m using anti-advertise but they put ******** links and e-mails and take my players away so i need to see what players are saying with cellphone.
here are the stuuf of the cellphone system in my gamemode:
pawn Код:
CMD:call(playerid,params[]) {
    new giveplayerid,string[128],giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME];
    if (sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /call <ID>");
//  if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
    if (PlayerInfo[playerid][LoggedIn] != 1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to make a phone call!");
        return 1;
    }
    if (GetPlayerMoney(playerid) < CALL_UNIT_COST)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You do not have enough money to make a phone call!");
        return 1;
    }
    if (giveplayerid == playerid)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot call yourself!");
        return 1;
    }
    if (!(IsPlayerConnected(giveplayerid)))
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "Inactive player id!");
        return 1;
    }
    if (Calling[playerid] > -1)
    {
        GetPlayerName(Calling[playerid], giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "You are already on the phone to %s!", giveplayer);
        SendClientMessage(playerid, COLOR_BRIGHTRED, string);
        return 1;
    }
    if (Calling[giveplayerid] > -1)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "%s is already on the phone, try again later", giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        return 1;
    }
    else
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "%s is ringing you, type /answer to answer the call or /hangup to ignore it", sendername);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You are ringing %s", giveplayer);
        SendClientMessage(playerid, COLOR_GREEN, string);
        Calling[playerid] = giveplayerid;
        Calling[giveplayerid] = playerid;
        Callerid[playerid] = 1;
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
    }
    return 1;
}
//---------------------------------Answer Phone---------------------------------
CMD:answer(playerid,params[]) {
    new string[128],giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME];
    if (PlayerInfo[playerid][LoggedIn] != 1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to answer a phone call!");
        return 1;
    }
    if (Calling[playerid] == -1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "Nobody is calling you!");
        return 1;
    }
    if (Answered[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are already on the phone!");
        return 1;
    }
    else
    {
        GetPlayerName(Calling[playerid], giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "%s has answered your call, talk away", sendername);
        SendClientMessage(Calling[playerid], COLOR_GREEN, string);
        format(string, sizeof(string), "You have answered %s's call, talk away", giveplayer);
        SendClientMessage(playerid, COLOR_GREEN, string);
        Answered[playerid] = 1;
        Answered[Calling[playerid]] = 1;
        Callerid[Calling[playerid]] = 1;
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
    }
    return 1;
}
//---------------------------------HangUp Phone---------------------------------
CMD:hangup(playerid,params[]) {
    new string[128],giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME];
    if (PlayerInfo[playerid][LoggedIn] != 1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to hang up a phone call!");
        return 1;
    }
    if (Calling[playerid] == -1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not on the phone!");
        return 1;
    }
    else
    {
        GetPlayerName(Calling[playerid], giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "%s has hung up the phone on you", sendername);
        SendClientMessage(Calling[playerid], COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have hung up on %s", giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        new bCalling = Calling[playerid];
        Calling[playerid] = -1;
        Answered[playerid] = 0;
        Callerid[playerid] = 0;
        Calling[bCalling] = -1;
        Answered[bCalling] = 0;
        Callerid[bCalling] = 0;
        SetPlayerSpecialAction(Calling[playerid],SPECIAL_ACTION_STOPUSECELLPHONE);
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
    }
    return 1;
}
pawn Код:
//=================================Phone stuff==================================
public PhoneCut(playerid)
{
    for (new i = 0; i < GetMaxPlayers(); i++)
    {
        if (Calling[i] > -1 && Answered[i] == 1 && Callerid[i] == 1)
        {
            if (GetPlayerMoney(i) >= CALL_UNIT_COST)
            {
                GivePlayerMoney(i, -CALL_UNIT_COST);
            }
            if (GetPlayerMoney(i) < CALL_UNIT_COST)
            {
                SendClientMessage(i, COLOR_BRIGHTRED, "CUT OFF: You don't have enough cash to continue this call");
                SendClientMessage(Calling[i], COLOR_BRIGHTRED, "CUT OFF: Your recipient's phone has been cut off due to lack of credit");
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
                Calling[Calling[i]] = -1;
                Answered[Calling[i]] = 0;
                Calling[i] = -1;
                Answered[i] = 0;
                Callerid[i] = 0;
            }
        }
    }
    return 1;
}

forward HighLight(playerid);
public HighLight(playerid)
{
    if(PlayerInfo[playerid][blipS] == 0) { SetPlayerColor(playerid, 0xFF0000AA); PlayerInfo[playerid][blipS] = 1; }
    else { SetPlayerColor(playerid, 0x33FF33AA); PlayerInfo[playerid][blipS] = 0; }
    return 0;
}
maybe this will help:
pawn Код:
if(ServerInfo[ReadPMs] == 1 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
    {
        new string[128],recievername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, string, sizeof(string)); GetPlayerName(id, recievername, sizeof(recievername));
        format(string, sizeof(string), "***PM: %s To %s: %s", string, recievername, gMessage);
        for (new a = 0; a < MAX_PLAYERS; a++) if ((PlayerInfo[a][Level] >= ServerInfo[MaxAdminLevel]) && a != playerid)
        SendClientMessage(a, grey, string);
    }
i want to be able to see what people write in celphone discussions just like in pm.



Re: help with cell phone cmds!! - TheArcher - 07.09.2011

You have to add if(ServerInfo[ReadPMs] == 1 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) above the line of discussion in cellphone.


Re : help with cell phone cmds!! - ahmed2793 - 08.09.2011

yeah but that will not allow me to read what they type in cellphone conversation!!


Re: Re : help with cell phone cmds!! - MadeMan - 08.09.2011

Quote:
Originally Posted by ahmed2793
Посмотреть сообщение
yeah but that will not allow me to read what they type in cellphone conversation!!
That's exactly what it DOES.


Re : help with cell phone cmds!! - ahmed2793 - 08.09.2011

ok where to add it exactly??


Re: help with cell phone cmds!! - MadeMan - 09.09.2011

Find the part in OnPlayerText that handles cellphone talk.