SA-MP Forums Archive
Range contract - 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: Range contract (/showthread.php?tid=545195)



Range contract - JaydenJason - 06.11.2014

Greetings reader,

I've came to seek help.
I'm using godfather script.

I'd appreciate it if someone could make this for me.
there's an existing command with sscanf CND:contract and a bit more
if player is within range of 2 metres off' a mafia (pMember == 8, pLeader == that they can use the cmd:contract command and then rp a line which is like "player hands a note to the mafia member" then mafia gets a message saying the name of the player, the price and idetification
"contracted name", "contract price", then in pink rp color ** Additional details of the suspect has been explained **

Laptop is broken ATM, if you need more information just comment here.


Re: Range contract - UltraScripter - 06.11.2014

Show The Code


Re: Range contract - JaydenJason - 06.11.2014

Able to show it tomorrow, laptop is gone ATM.


Re : Range contract - D3vin - 07.11.2014

pawn Код:
if(strcmp(cmd, "/contract", true) == 0)
    {
        if(PlayerInfo[playerid][pLevel] >= 2)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                return 1;
            }
            moneys = strvalEx(tmp);
            if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { SendClientMessage(playerid, COLOR_GREY, "   Hitmen cannot place contracts on people !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "   You cannot Contract yourself !"); return 1; }
                    if(PlayerInfo[giveplayerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "  You can not place contracts on people level 1-2");
                    if(moneys < 10000) { SendClientMessage(playerid, COLOR_GREY, "   Contract money must be at least $10000 !"); return 1; }
                    if(moneys + PlayerInfo[giveplayerid][pHeadValue] > 1000000) { SendClientMessage(playerid, COLOR_GREY, "   That player has the maximum amount on their head !"); return 1; }
                    if(IsACop(giveplayerid) && IsATrooper(playerid) && moneys < 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract price must be atleast $100000 for Cops !"); return 1; }
                    if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0) { SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !"); return 1; }
                    new playermoney = PlayerInfo[playerid][pCash];
                    if(moneys > 0 && playermoney >= moneys)
                    {
                        strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
                        strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME);
                        format(string, sizeof(string), "%s", sendername);
                        strmid(PlayerInfo[giveplayerid][pContractBy], string, 0, strlen(string), 255);
                        PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                        GivePlayerMoney(playerid, (0 - moneys));
                        PlayerInfo[giveplayerid][pHeadValue]+=moneys;
                        format(string, sizeof(string), "%s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                        SendFamilyMessage(8, COLOR_YELLOW, string);
                        format(string, sizeof(string), "{FF0000}AdmWarning{FFFF00}: %s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                        ABroadCast(COLOR_WHITE,string,4);
                        format(string, sizeof(string), "* You placed a contract on %s, for $%d.",giveplayer, moneys);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount !");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "   You must be atleast level 2 to place a Contract !");
        }
    }



Re: Range contract - JaydenJason - 07.11.2014

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
Show The Code

Код:
if(strcmp(cmd, "/contract", true) == 0)
    {
        if(PlayerInfo[playerid][pLevel] >= 2)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /contract [playerid/PartOfName] [amount]");
                return 1;
            }
            moneys = strvalEx(tmp);
            if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { SendClientMessage(playerid, COLOR_GREY, "   Hitmen cannot place contracts on people !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "   You cannot Contract yourself !"); return 1; }
                    if(PlayerInfo[giveplayerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "  You can not place contracts on people level 1-2");
                    if(moneys < 10000) { SendClientMessage(playerid, COLOR_GREY, "   Contract money must be at least $10000 !"); return 1; }
                    if(moneys + PlayerInfo[giveplayerid][pHeadValue] > 1000000) { SendClientMessage(playerid, COLOR_GREY, "   That player has the maximum amount on their head !"); return 1; }
                    if(IsACop(giveplayerid) && IsATrooper(playerid) && moneys < 100000) { SendClientMessage(playerid, COLOR_GREY, "   Contract price must be atleast $100000 for Cops !"); return 1; }
                    if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0) { SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !"); return 1; }
                    new playermoney = PlayerInfo[playerid][pCash];
                    if(moneys > 0 && playermoney >= moneys)
                    {
                        strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
                        strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME);
                        format(string, sizeof(string), "%s", sendername);
                        strmid(PlayerInfo[giveplayerid][pContractBy], string, 0, strlen(string), 255);
                        PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys;
                        GivePlayerMoney(playerid, (0 - moneys));
                        PlayerInfo[giveplayerid][pHeadValue]+=moneys;
                        format(string, sizeof(string), "%s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                        SendFamilyMessage(8, COLOR_YELLOW, string);
                        format(string, sizeof(string), "{FF0000}AdmWarning{FFFF00}: %s has placed a contract on %s, for $%d.",sendername, giveplayer, moneys);
                        ABroadCast(COLOR_WHITE,string,4);
                        format(string, sizeof(string), "* You placed a contract on %s, for $%d.",giveplayer, moneys);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount !");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "   You must be atleast level 2 to place a Contract !");
        }
    }



Re: Range contract - JaydenJason - 10.11.2014

Anytime soon? Im in need of this!


Re: Range contract - JaydenJason - 11.11.2014

Still no response, sigh.