Fine Wanted Level
#1

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
Reply
#2

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

Reply
#3

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;
}
Reply
#4

Yes something like that.
Reply
#5

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)
Reply
#6

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 !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)