bounty
#1

Hi, i have bounty stuff in server and i want to save the bounty for player cash in file but its a bit difficult.
Bounty is in different playerid getting stuff. really dont know how to explane than just to show.
pawn Код:
new giveplayer[MAX_PLAYER_NAME];
and bounty shit. its really doesnt metter cuz i just want to know how to save player info if he have different id getting stuff.
pawn Код:
bounty[giveplayerid]+=moneys;
its giveplayerid but to save its playerid. ok hope u understand my question cuz im little drunk or dizzy or what ever hehe.
Thanks dudes.
Reply
#2

Quote:
Originally Posted by bleedis
Посмотреть сообщение
ok hope u understand my question cuz im little drunk or dizzy or what ever hehe.
Come back when you are sober again, because I can't understand what you want to do. A command /bounty ?
Reply
#3

no, i have bounty command. This is whole script for bounty,
pawn Код:
//HITMAN------------------------------------------------------------------------
    if(strcmp(cmd, "/hitman", true) == 0) {
   
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "{8FE11F}** {C8D1CC}/hitman [id] [daudzums]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "{8FE11F}** {C8D1CC}/hitman [id] [daudzums]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, COLOR_GREY, "{ff0000}** {C8D1CC}Jums nepietiek naudas!");
            return 1;
        }
        if(moneys < 500) {
            SendClientMessage(playerid, COLOR_GREY, "{ff0000}** {C8D1CC}Minimālā summa $500!");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, COLOR_GREY, "{ff0000}** {C8D1CC}Љāds spēlētājs neeksistē!");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));


        format(string, sizeof(string), "Uz spēlētāja %s tika uzlikta $%d liela atlīdzība, no spēlētāja %s [Kopā: $%d].", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(COLOR_ORANGE, string);

        format(string, sizeof(string), "Uz jums tika uzlikta $%d liela atlīdzība, no spēlētāja %s [ID:%d].", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_WHITE, string);

        return 1;
    }
//BOUNTY------------------------------------------------------------------------

    if(strcmp(cmd, "/bounty", true) == 0) {
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "{8FE11F}** {C8D1CC}/bounty [id]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "Uz %s [ID:%d] ir uzlikta $%d liela atlīdzība!", giveplayer,giveplayerid,bounty[giveplayerid]);
            SendClientMessage(playerid, COLOR_WHITE, string);
        } else {
            SendClientMessage(playerid, COLOR_GREY, "{ff0000}** {C8D1CC}Љads spēlētājs neeksistē!");
        }

        return 1;
    }
//BOUNTIES----------------------------------------------------------------------

    if(strcmp(cmd, "/bounties", true) == 0)
    {
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Atlīdzību saraksts:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s[%d]: $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_WHITE, string);
        }

        return 1;
    }
I thought that i can save that bountie stattus in file but its setting for giveplayerid but for saving its using playerid like

pawn Код:
SavePlayer(playerid)
{

    dUserSetINT(PlayerName2(playerid)).("Jailed",PlayerInfo[playerid][Jailed]);
    dUserSetINT(PlayerName2(playerid)).("JailTime",PlayerInfo[playerid][JailTime]);
    dUserSetINT(PlayerName2(playerid)).("Muted",PlayerInfo[playerid][Muted]);
    dUserSetINT(PlayerName2(playerid)).("MuteTime",PlayerInfo[playerid][MuteTime]);
    dUserSetINT(PlayerName2(playerid)).("money",GetPlayerMoney(playerid));
    dUserSetINT(PlayerName2(playerid)).("Bank",PlayerInfo[playerid][Bank]);
how to get that player disconnect he got his bounty saved?
Reply
#4

Just add this to SavePlayer

pawn Код:
dUserSetINT(PlayerName2(playerid)).("bounty",bounty[playerid]);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)