Jump to content
  • 0

Problema /su


Loweast

Question

Salut Sa:MP Romania.

Am si eu o problema cu comanda /suspect (Give Wanted PD/SRI/Armata)

Cand esti cop si dai unui player (ex) /su low 5 test apare ca i-ai dat wantedul dupa ii dispare...

Deci mai pe scurt nu se pune wantedul..

Comanda:

[pawn]if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)

    {

        if(IsPlayerConnected(playerid))

        {

            tmp = strtok(cmdtext, idx);

            if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [Wanted] [Reason]");

            new playa;

            new money;

            playa = ReturnUser(tmp);

            tmp = strtok(cmdtext, idx);

            money = strval(tmp);

            if (IsACop(playerid))

            {

                if(IsPlayerConnected(playa))

                {

                    if(playa != INVALID_PLAYER_ID)

                    {

                        new length = strlen(cmdtext);

                        while ((idx < length) && (cmdtext[idx] <= ' '))

                        {

                            idx++;

                        }

                        new offset = idx;

                        new result[64];

                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))

                        {

                            result[idx - offset] = cmdtext[idx];

                            idx++;

                        }

                        result[idx - offset] = EOS;

                        result[0] = toupper(result[0]);

                        if(!strlen(result)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [Wanted] [Reason]");

                        if (gTeam[playa] == 2 || IsACop(playa)) return SendClientMessage(playerid, -1, "You can't Suspect a Cop!");

                        if(PlayerInfo[playa][pJailed] == 1 || PlayerInfo[playa][pJailed] == 2) return SendClientMessage(playerid, COLOR_WHITE, "You can't suspect a jailed player");

                        if(money > 10) return SendClientMessage(playerid, COLOR_GREY, "Maximum wanted level is 10!");

                        if(money == 0) return SendClientMessage(playerid, COLOR_GREY, "Minimum wanted level is 0!");

                        if(PlayerInfo[playa][pWanted] > 9) return SendClientMessage(playerid, COLOR_GREY, "That player have Maxim Wanted Level! (Wanted 10)");

                        format(string, sizeof(string), "Thay player have Wanted %d , give him a lower wanted level", PlayerInfo[playa][pWanted]);

                        if(PlayerInfo[playa][pWanted] + money > 10) return SendClientMessage(playerid, COLOR_GREY, string);

                        PlayerInfo[playa][pWanted] += money;

                    new wl = PlayerInfo[playa][pWanted];

SetPlayerWantedLevel(playa, wl);

                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));

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

                        format(string, sizeof(string), "You commited a crime ( %s ) [+%d],Raportat de: %s",result,money,sendername);

                        SendClientMessage(playa, COLOR_LIGHTRED, string);

                        for(new i = 0; i < MAX_PLAYERS; i++)

                        {

                            if(IsPlayerConnected(i))

                            {

                                if(PlayerInfo[pMember] == 1 || PlayerInfo[pLeader] == 1 || PlayerInfo[pMember] == 2 || PlayerInfo[pLeader] == 2 || PlayerInfo[pMember] == 3 || PlayerInfo[pLeader] == 3)

                                {

                                    format(string, sizeof(string), "HQ: All units APB: Reporter: %s.",sendername);

                                    SendClientMessage(i, 0x0000C1FF, string);

                                    format(string, sizeof(string), "HQ: Crime: %s[+%d], Suspect: %s. ",result,money,giveplayer);

                                    SendClientMessage(i, 0x0000C1FF, string);

                                }

                            }

                        }

                    }

                }

            } else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop!");

        }

        return 1;

    }[/pawn]

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Incearca :

	if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /(su)spect [playerid/numejucator] [wantedlevel] [motiv]");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (IsACop(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[182];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /(su)spect [playerid/numejucator] [wlevel] [motiv]");
                            return 1;
                          }
                        if (gTeam[playa] == 2 || IsACop(playa))
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "Nu poti da in urmarire politisti!");
                            return 1;
                        }
                        if(money > 6)
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "Nivelul de urmarire trebuie sa fie intre 1 si 6 !");
                            return 1;
                        }
                        if(money == 0)
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "Nivelul de urmarire trebuie sa fie intre 1 si 6 !");
                            return 1;
                        }
                        new string1[182];
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        WantedLevel[playa] += money;
                        PlayerData[giveplayerid][pWantedPoints] = WantedPoints[giveplayerid];
						format(string, sizeof(string), "UPDATE players SET WantedPoints='%d' WHERE id=%d", PlayerData[giveplayerid][pWantedPoints], PlayerData[giveplayerid][pSQLID]);
						mysql_query(string);
                        if(WantedLevel[playa] > 6) WantedLevel[playa] = 6;
                        SetPlayerWantedLevel(playa, WantedLevel[playa]);
                        format(string, sizeof(string), "Ai comis o crima ( %s ). Reclamant: %s.",result,sendername);
                        SendClientMessage(playa, COLOR_LIGHTRED, string);
                        format(string1, sizeof(string1), "Nivelul tau de urmarire: %d", money);
                        SendClientMessage(playa, COLOR_YELLOW, string1);
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerData[i][pMember] == 1||PlayerData[i][pLeader] == 1||PlayerData[i][pMember] == 2||PlayerData[i][pLeader] == 2||PlayerData[i][pMember] == 3||PlayerData[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "PR: Toate unitatile APB: Reclamant: %s",sendername);
                                    SendClientMessage(i, TEAM_BLUE_COLOR, string);
                                    format(string, sizeof(string), "PR: Crima: %s | Suspect: %s | Nivel de urmarire: %d",result,giveplayer,money);
                                    SendClientMessage(i, TEAM_BLUE_COLOR, string);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "Nu esti politist !");
            }
        }
        return 1;
    }

Link to comment
Share on other sites

Uite pe asta o am eu

[pawn]

//----------------------------------[setCrim]-----------------------------------------------

if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)

    {

        if(IsPlayerConnected(playerid))

        {

            tmp = strtok(cmdtext, idx);

            if(!strlen(tmp))

            {

                SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}USAGE:{FFFFFF}: /(su)spect [playerid/PartOfName] [wantedlevel] [reason]");

                return 1;

            }

            new playa;

            new wanted;

            playa = ReturnUser(tmp);

            tmp = strtok(cmdtext, idx);

            wanted = strval(tmp);

            if (IsACop(playerid))

            {

                if(IsPlayerConnected(playa))

                {

                    if(playa != INVALID_PLAYER_ID)

                    {

                        new length = strlen(cmdtext);

                        while ((idx < length) && (cmdtext[idx] <= ' '))

                        {

                            idx++;

                        }

                        new offset = idx;

                        new result[64];

                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))

                        {

                            result[idx - offset] = cmdtext[idx];

                            idx++;

                        }

                        result[idx - offset] = EOS;

                        if(!strlen(result))

                        {

                            SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}USAGE:{FFFFFF}: /(su)spect [playerid/PartOfName] [wlevel] [reason]");

                            return 1;

                        }

                        if (gTeam[playa] == 2 || IsACop(playa))

                        {

                            SendClientMessage(playerid, COLOR_WHITE, "  You can't suspect cops!");

                            return 1;

                        }

if(PlayerInfo[playa][pJailed] >= 1)

{

SendClientMessage(playerid, COLOR_WHITE, "  This player is already in Jail!");

return 1;

}

                        if(wanted > 10)

                        {

                            SendClientMessage(playerid, COLOR_WHITE, "  Wanted level must be between 1 and 10 !");

                            return 1;

                        }

                        if(wanted <= 0)

                        {

                            SendClientMessage(playerid, COLOR_WHITE, "  Wanted level must be between 1 and 10 !");

                            return 1;

                        }

new check = WantedLevel[playa] + wanted;

if(check > 10)

{

                            SendClientMessage(playerid, COLOR_WHITE, "  You went over the wanted level limit of 10 !");

                            return 1;

                        }

                        new string1[128];

                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));

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

                        WantedLevel[playa] += wanted;

                        WantedPoints[playa] += wanted*2;

                        format(string, sizeof(string), "You've commited a Crime ( %s ). Reporter: %s.",result,sendername);

                        SendClientMessage(playa, COLOR_LIGHTRED, string);

if(PlayerInfo[playa][pClubMember] == 1 || PlayerInfo[playa][pClubLeader] == 1)

{

new vehicle;

vehicle = GetPlayerVehicleID(playa);

if(IsAnNFSCar(vehicle))

{

GiveBounty(playa, 1000);

SCM(playerid, COLOR_DNB, "[NFS Club]Ai primit 1.000 Bounty Points pentru ca ai primit Wanted");

}

}

else if(PlayerInfo[playa][pClubMember] == 2 || PlayerInfo[playa][pClubLeader] == 2)

{

new vehicle;

vehicle = GetPlayerVehicleID(playa);

if(IsAnNRGCar(vehicle))

{

GiveBounty(playa, 1000);

SCM(playerid, COLOR_DNB, "[NRG Club]Ai primit 1.000 Bounty Points pentru ca ai primit Wanted");

}

}

                        format(string1, sizeof(string1), "Current Wanted Level: %d", WantedLevel[playa]);

                        SendClientMessage(playa, COLOR_YELLOW, string1);

                        for(new i = 0; i <= MAX_PLAYERS; i++)

                        {

                            if(IsPlayerConnected(i))

                            {

                                if(PlayerInfo[pMember] == 1||PlayerInfo[pLeader] == 1||PlayerInfo[pMember] == 2||PlayerInfo[pLeader] == 2||PlayerInfo[pMember] == 3||PlayerInfo[pLeader] == 3)

                                {

                                    format(string, sizeof(string), "HQ: All Units APB: Reporter: %s",sendername);

                                    SendClientMessage(i, TEAM_BLUE_COLOR, string);

                                    format(string, sizeof(string), "HQ: Crime: %s, Suspect: %s, WantedLevel: %d",result,giveplayer,WantedLevel[playa]);

                                    SendClientMessage(i, TEAM_BLUE_COLOR, string);

                                }

                            }

                        }

                    }

                }

            }

            else

            {

                SendClientMessage(playerid, COLOR_WHITE, "You are not a Cop !");

            }

        }

        return 1;

    }

[/pawn]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.