[HELP] Player Wanted Level
#1

Hello. So I have speed cameras in my server and if someone is speeding for example on 100 km/h, when it's allowed only 80 km/h, the player gets PlayerInfo[i][pWantedLevel]++;. There is a police class, in which you can use a command "/fine", to remove wanted levels from a player for cash, which means, police gets cash and score for giving a fine for a player.

Each WantedLevel is $500. If wanted level is 2, then $1000, if 3 = $1500 etc. I want to know, would be there a short way, like calculating the wanted levels? I just don't want to write a really long line of if(PlayerInfo[playerid][pWantedLevel] < 1), if(PlayerInfo[playerid][pWantedLevel] < 2) etc. But when 50*500=$25000

Here is the code, from "/fine" command:

PHP код:
CMD:fine(playeridparams[])
{
        new 
playerid2;
        new 
id;
        if (
sscanf(params"u"id)) SendClientMessage(playerid0xCCCC99AA"USAGE: /fine [playerid]");
        else if (
id == INVALID_PLAYER_IDSendClientMessage(playerid0xFF0000AA"Player is not online.");
        else
        {
        if(
PlayerInfo[playerid][pClass] == 3)
        {
        if(
GetDistanceBetweenPlayers(playeridplayerid2) > 5)
        {
        if(
PlayerInfo[playerid][pWantedLevel] < 0)
        {
        
SendClientMessage(playerid0x00FF00AA"Player is not wanted!");
        }
        if(
PlayerInfo[playerid][pWantedLevel] < 1)
        {
        
GivePlayerMoney(playerid500);
        
GivePlayerMoney(id, -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];
        
SetPlayerScoreplayeridGetPlayerScoreplayerid ) + );
        
format(tstring,sizeof(tstring),"You Have Been Fined -$1000 By Police Officer %s(%d).",pname,playerid);
        
format(tstring,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);
          }
        }
        }
        }
        return 
1;

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)