[HELP] Player Wanted Level
#9

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
pawn Код:
CMD:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pClass] == 3)
    {
        if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
        new iTargetID;
        if(sscanf(params, "u", iTargetID)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/su)spect [player]");
        if(!IsPlayerConnected(iTargetID))  return SendClientMessageEx(playerid, COLOR_WHITE, "{0049FF}ERROR{00A5FF}: Invalid player specified.");
        if(PlayerInfo[iTargetID][pClass] == 3) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't use this command on a law enforcement officer.");
         if(PlayerInfo[iTargetID][pWantedLevel] >= 6) return SendClientMessageEx(playerid, COLOR_GRAD2, "Target is already most wanted.");
        if(PlayerInfo[iTargetID][pWantedLevel] == 0) return SendClientMessageEx(playerid, COLOR_WHITE, "Player is not wanted.");
        GivePlayerMoney(playerid, PlayerInfo[playerid][pWantedLevel]*500); // darkwood's code  | 2 * 500 = 1000 | 5 * 500 = 25000, a quicker way.
        GivePlayerMoney(id, PlayerInfo[playerid][pWantedLevel] * -500);

        new tname[MAX_PLAYER_NAME];
        GetPlayerName(id,tname,sizeof(tname));
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pname,sizeof(pname));
        new tstring[128];
        new pstring[128];
        SetPlayerScore( playerid, GetPlayerScore( playerid ) + 1 );
        format(tstring,sizeof(tstring),"You Have Been Fined -$1000 By Police Officer %s(%d).",pname,playerid);
        format(pstring,sizeof(pstring),"You have fined %s(%d)! And His Wanted Level Was 1 You Got +1000$",tname,id);
        SendClientMessage(id,COLOR_RED,tstring);
        SendClientMessage(playerid,COLOR_RED,pstring);

    }
    else SendClientMessageEx(playerid, COLOR_GRAD2, "You're not a law enforcement officer.");
    return 1;
}
this, is an optimized form of your command
In 1 way, yes this is optimized, but what if he wanted other things to happen at a higher wanted level, eg: loss of usage of guns at 4 wanted level + or take drivers license away only at wanted level 1,2,3 or what if he doesnt want the price to go up in that rate phase, he can easily define for each level alot easier this way, he isn't limited in any way, he can control each level with my code :P
EDIT: Thanks for fixing the problem with the code I made, but I wasn't trying to pinpoint that part, I was just showing a template of some sort for him to use, as a general guide line.
Reply


Messages In This Thread
[HELP] Player Wanted Level - by D1am0nd - 31.01.2016, 12:49
Re: [HELP] Player Wanted Level - by Darkwood17 - 31.01.2016, 13:00
Re: [HELP] Player Wanted Level - by D1am0nd - 31.01.2016, 14:04
Re: [HELP] Player Wanted Level - by SkyFlare - 31.01.2016, 14:19
Re: [HELP] Player Wanted Level - by Darkwood17 - 31.01.2016, 14:26
Re: [HELP] Player Wanted Level - by SkyFlare - 31.01.2016, 14:30
Re: [HELP] Player Wanted Level - by Darkwood17 - 31.01.2016, 14:34
Re: [HELP] Player Wanted Level - by Sawalha - 31.01.2016, 14:36
Re: [HELP] Player Wanted Level - by SkyFlare - 31.01.2016, 14:39
Re: [HELP] Player Wanted Level - by Sawalha - 31.01.2016, 14:40

Forum Jump:


Users browsing this thread: 1 Guest(s)