PDA

View Full Version : Fine Wanted Level


Playr
14/06/2015, 12:38 PM
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

J0sh...
14/06/2015, 12:49 PM
In the callback
if(GetPlayerWantedLevel(playerid) == numberhere)
{
//code
}

Playr
14/06/2015, 01:00 PM
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;
}

J0sh...
14/06/2015, 01:05 PM
Yes something like that.

b3nz
14/06/2015, 01:16 PM
You don't really need to check every single wanted level. You can do it this way:

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:

if (pickupid == pickup1, pickup2, pickup3)

You must do it this way:

if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)

Playr
14/06/2015, 01:42 PM
You don't really need to check every single wanted level. You can do it this way:

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:

if (pickupid == pickup1, pickup2, pickup3)

You must do it this way:

if (pickupid == pickup1 || pickupid == pickup2 || pickupid == pickup3)

This Works Thank You !!