SA-MP Forums Archive
accept cmd help! have problem +rep! - 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: accept cmd help! have problem +rep! (/showthread.php?tid=560882)



accept cmd help! have problem +rep! - Barnwell - 31.01.2015

Hello All i have a problem when i i go to job tell me /join i write /join and tell /accept job

when i write /accept job tell again SCM(playerid, COLOR_WHITE, "|__________________ Accept __________________|");
SCM(playerid, COLOR_WHITE, "USAGE: accept [name]");
SCM(playerid, COLOR_GREY, "Available names: live, medic, ticket, heal, job, car, house, family,
and again and again and again i try all names

+rep who help me!

Here the accept command

pawn Код:
CMD:accept(playerid, params[])//656
{
    LogCallback("accept");
    new x_job[64], string[128];
    if(sscanf(params, "s[64]", x_job))
    {
        SCM(playerid, COLOR_WHITE, "|__________________ Accept __________________|");
        SCM(playerid, COLOR_WHITE, "USAGE: accept [name]");
        SCM(playerid, COLOR_GREY, "Available names: live, medic, ticket, heal, job, car, house, family, divorce, witness, marriage, taxi");
        SCM(playerid, COLOR_GREY, "Available names: lawyer, refill, repair, mechanic, weed, cocaine, crack, release, keys, heal, methadone");
        SCM(playerid, COLOR_WHITE, "|____________________________________________|");
        return 1;
    }
    if(strcmp(x_job,"family",true) == 0)
    {
        if(FamilyOffer[playerid] < 999)
        {
            if(IsPlayerConnected(FamilyOffer[playerid]))
            {
                if(PlayerInfo[FamilyOffer[playerid]][pFMember] != 255)
                {
                    if(PlayerInfo[playerid][pMember] != 0 || PlayerInfo[playerid][pLeader] != 0 || PlayerInfo[playerid][pFMember] != 255)
                    {
                        SCM(playerid, COLOR_GREY, "   You are already in a Faction / Family !");
                        return 1;
                    }
                    new family = PlayerInfo[FamilyOffer[playerid]][pFMember];
                    format(string, sizeof(string), "* You have accepted %s's request to join %s, you are now a Member of it.", GPN(FamilyOffer[playerid]), FamilyInfo[family][FamilyName]);
                    SCM(playerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "* %s has accepted your request and is now a Member of your Family.", GPN(playerid));
                    SCM(FamilyOffer[playerid], COLOR_LIGHTBLUE, string);
                    PlayerInfo[playerid][pFMember] = family;
                    ChosenSkin[playerid] = FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySkin1];
                    SetPlayerSkin(playerid, ChosenSkin[playerid]);
                    FamilyOffer[playerid] = 999;
                    FamilyInfo[family][FamilyMembers] ++;
                    SaveFamilies();
                    return 1;
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   The player who invited you is no longer a member of a family !");
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "   Nobody sent you a family invite !");
            return 1;
        }
    }
    else if(strcmp(x_job,"divorce",true) == 0)
    {
        if(DivorceOffer[playerid] < 999)
        {
            if(IsPlayerConnected(DivorceOffer[playerid]))
            {
                if(ProxDetectorS(10.0, playerid, DivorceOffer[playerid]))
                {
                    format(string, sizeof(string), "* You have accepted %s's request to divorce", GPN(DivorceOffer[playerid]));
                    SCM(playerid, COLOR_WHITE, string);
                    format(string, sizeof(string), "* %s has accepted your to devorce", GPN(playerid));
                    SCM(DivorceOffer[playerid], COLOR_WHITE, string);
                    ClearMarriage(playerid);
                    ClearMarriage(DivorceOffer[playerid]);
                    PlayerInfo[playerid][pPhousekey] = 9999;
                    PlayerInfo[playerid][pPbiskey] = 9999;
                    return 1;
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   The player that sent you the Divorce Papers is not near you !");
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "   No-one sent you any Divorce Papers !");
            return 1;
        }
    }
    else if(strcmp(x_job,"witness",true) == 0)
    {
        if(MarryWitnessOffer[playerid] < 999)
        {
            if(IsPlayerConnected(MarryWitnessOffer[playerid]))
            {
                if(ProxDetectorS(10.0, playerid, MarryWitnessOffer[playerid]))
                {
                    format(string, sizeof(string), "* You have accepted %s's request to be their Marriage Witness.", GPN(MarryWitnessOffer[playerid]));
                    SCM(playerid, COLOR_WHITE, string);
                    format(string, sizeof(string), "* %s has accepted your request to be your Marriage Witness.", GPN(playerid));
                    SCM(MarryWitnessOffer[playerid], COLOR_WHITE, string);
                    MarryWitness[MarryWitnessOffer[playerid]] = playerid;
                    MarryWitnessOffer[playerid] = 999;
                    return 1;
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   The player that requested you to be their Marriage Witness is not near you !");
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "   No-one asked you to be their Marriage Witness !");
            return 1;
        }
    }
    else if(strcmp(x_job,"marriage",true) == 0)
    {
        if(ProposeOffer[playerid] < 999)
        {
            if(!IsPlayerInRangeOfPoint(playerid, 10, 2232.3047,-1333.1543,23.9815))
            {
                SCM(playerid, COLOR_GREY, "   You are not at the Church in Jefferson !");
                return 1;
            }
            if(IsPlayerConnected(ProposeOffer[playerid]))
            {
                if(ProxDetectorS(10.0, playerid, ProposeOffer[playerid]))
                {
                    if(MarryWitness[ProposeOffer[playerid]] == 999)
                    {
                        SCM(playerid, COLOR_GREY, "   The proposer doesn't have a Marriage Witness !");
                        return 1;
                    }
                    if(IsPlayerConnected(MarryWitness[ProposeOffer[playerid]]))
                    {
                        if(ProxDetectorS(12.0, ProposeOffer[playerid], MarryWitness[ProposeOffer[playerid]]))
                        {
                            format(string, sizeof(string), "* You have accepted %s's request to be your Husband.", GPN(ProposeOffer[playerid]));
                            SCM(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* %s has accepted your request to be your Wife.", GPN(playerid));
                            SCM(ProposeOffer[playerid], COLOR_WHITE, string);
                            format(string, sizeof(string), "Priest: %s do you take %s as your lovely Husband? (type 'yes', anything else will reject the Marriage)", GPN(playerid), GPN(ProposeOffer[playerid]));
                            SCM(playerid, COLOR_WHITE, string);
                            MarriageCeremoney[playerid] = 1;
                            ProposedTo[ProposeOffer[playerid]] = playerid;
                            GotProposedBy[playerid] = ProposeOffer[playerid];
                            MarryWitness[ProposeOffer[playerid]] = 999;
                            ProposeOffer[playerid] = 999;
                            return 1;
                        }
                        else
                        {
                            SCM(playerid, COLOR_GREY, "   The Marriage Witness is not near your proposer !");
                            return 1;
                        }
                    }
                    return 1;
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   The player that proposed to you is not near you !");
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "   No-one Proposed to you !");
            return 1;
        }
    }
    else if(strcmp(x_job,"ticket",true) == 0)
    {
        if(TicketOffer[playerid] < 999)
        {
            if(IsPlayerConnected(TicketOffer[playerid]))
            {
                if (ProxDetectorS(5.0, playerid, TicketOffer[playerid]))
                {
                    format(string, sizeof(string), "* You have paid the Ticket of $%d to Officer %s.", TicketMoney[playerid], GPN(TicketOffer[playerid]));
                    SCM(playerid, COLOR_WHITE, string);
                    format(string, sizeof(string), "* %s has paid your Ticket of $%d.", GPN(playerid), TicketMoney[playerid]);
                    SCM(TicketOffer[playerid], COLOR_WHITE, string);
                    SafeGivePlayerMoney(playerid, - TicketMoney[playerid]);
                    SafeGivePlayerMoney(TicketOffer[playerid], TicketMoney[playerid]);
                    TicketOffer[playerid] = 999;
                    TicketMoney[playerid] = 0;
                    return 1;
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "   The Officer is not near you !");
                    return 1;
                }
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "   No-one offered you a Ticket !");
            return 1;
        }
    }

    else if(strcmp(x_job,"job",true) == 0)
    {
        if(GettingJob[playerid] == 0) return SCM(playerid, -1 , "You haven't even attempted to get a job yet you bum.");
        if(PlayerInfo[playerid][pJob][0] == 0)
        {
            if(GettingJob[playerid] != 0)
            {
                PlayerInfo[playerid][pJob][0] = GettingJob[playerid];
                GettingJob[playerid] = -1;
                SCM(playerid, COLOR_LIMEGREEN , "You are now employed! Congrats, now get to work.");
            }
        }



Re: accept cmd help! have problem +rep! - icra - 31.01.2015

Try debugging x_job,

Код:
CMD:accept(playerid,params[]) {
    new x_job[64];

    if(sscanf(params,"s[64]",x_job)) return 1;
    printf("%s",xjob);
}