SA-MP Forums Archive
Fine Wanted Level - 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: Fine Wanted Level (/showthread.php?tid=577822)



Fine Wanted Level - Playr - 14.06.2015

Hello!
I am trying to make a Fine wanted level system for my server , i made it with a pickup and wen a player runs in to it he cleans the stars and removes a ammount of money from them.
This is the script:
__________________________________________________ _______________________________________________
new pickup;
new pickup1;
new pickup2;

public OnGameModeInit()
{
pickup = CreatePickup(19198, 1, 2289.9194,2429.9109,11.2961, 0);
pickup1 = CreatePickup(19198, 1, 1554.3624, -1675.7025, 16.4175, 0);
pickup2 = CreatePickup(19198, 1, -1619.9443, 681.3761, 7.4742, 0);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup, pickup1, pickup2 )
{
SetPlayerWantedLevel(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE,"You Cleaned Your Stars! Slow Down Next Time ");
SendClientMessage(playerid, COLOR_RED,"2000$ Has been reduce from your account");
GivePlayerMoney(playerid, -2000);

}
return 1;

}
__________________________________________________ _______________________________________________

But this give me a problem becouse wenever they run in to it this takes the money even if they dont hve stars, an i wanted to make it like if they hve 1 star it removes 1000$ , 2 stars 2000$ , 3 stars 3000$ untill 6 stars becouse i will make it get arrested if they get + than 6 . If possible i wanted to make this is a msgbox so the player can cancel the process if they just run in by mystake .

Thank You


Re: Fine Wanted Level - J0sh... - 14.06.2015

In the callback
PHP код:
if(GetPlayerWantedLevel(playerid) == numberhere)
{
//code




Re: Fine Wanted Level - Playr - 14.06.2015

i Make a callback for the stars the player have ?
Like

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(GetPlayerWantedLevel(playerid)== 1 )
{
SetPlayerWantedLevel(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE,"You Cleaned Your Stars! Slow Down Next Time ");
SendClientMessage(playerid, COLOR_RED,"1000$ Has been reduce from your account");
GivePlayerMoney(playerid, -1000);
}
return 1;

if(GetPlayerWantedLevel(playerid)== 2 )
{
SetPlayerWantedLevel(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE,"You Cleaned Your Stars! Slow Down Next Time ");
SendClientMessage(playerid, COLOR_RED,"2000$ Has been reduce from your account");
GivePlayerMoney(playerid, -2000);
}
return 1;
}


Re: Fine Wanted Level - J0sh... - 14.06.2015

Yes something like that.


Re: Fine Wanted Level - b3nz - 14.06.2015

You don't really need to check every single wanted level. You can do it this way:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)
    {
        new szMessage [57 + 1];
       
        format (szMessage, 57, "You've cleaned your stars! %d was taken from your pocket.", GetPlayerWantedLevel (playerid) * 1000);
        SendClientMessage (playerid, COLOR_WHITE, szMessage);
       
        GivePlayerMoney (playerid, GetPlayerMoney (playerid) - (GetPlayerWantedLevel (playerid) * 1000));
        SetPlayerWantedLevel (playerid, 0);
    }
   
    return (true);
}
Also, you can't check things like that:

pawn Код:
if (pickupid == pickup1, pickup2, pickup3)
You must do it this way:

pawn Код:
if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)



Re: Fine Wanted Level - Playr - 14.06.2015

Quote:
Originally Posted by b3nz
Посмотреть сообщение
You don't really need to check every single wanted level. You can do it this way:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)
    {
        new szMessage [57 + 1];
       
        format (szMessage, 57, "You've cleaned your stars! %d was taken from your pocket.", GetPlayerWantedLevel (playerid) * 1000);
        SendClientMessage (playerid, COLOR_WHITE, szMessage);
       
        GivePlayerMoney (playerid, GetPlayerMoney (playerid) - (GetPlayerWantedLevel (playerid) * 1000));
        SetPlayerWantedLevel (playerid, 0);
    }
   
    return (true);
}
Also, you can check things like that:

pawn Код:
if (pickupid == pickup1, pickup2, pickup3)
You must do it this way:

pawn Код:
if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)
This Works Thank You !!