10.03.2012, 19:01
This is an example on how to do it.
pawn Код:
new
starpickup, // A new variable that will hold the pickup
price; // A variable to hold how much they have to pay.
public OnGameModeInit()
{
// This assings the variable to CreatePickup for later use.
starpickup = CreatePickup(/* Your params go here*/);
return 1;
}
public OnPlayerPickupPickUp(playerid,pickupid)
{
if(pickupid == starpickup) // If they go into the pickup
{
new wantedlevel = GetPlayerWantedLevel(playerid); // A variable that holds their wanted level.
if(wantedlevel > 0) // If they have more than one star
{
price = wantedlevel*1000; // Then the price is 1,000 per star.
new string[124];
format(string,sizeof(string),"Use /payfine to pay off your stars. The price will be $%d.",price);
SendClientMessage(playerid,-1,string);
return 1;
}
// If they don't have a wanted level it sends the message below.
else return SendClientMessage(playerid,-1,"You don't have a wanted level.");
}
return 1;
}
CMD:payfine(playerid,params[])
{
if(GetPlayerMoney < price) // If they don't have enough money
{
// Then it sends the message.
return SendClientMessage(playerid,-1,"You don't have enough money!");
}
else // If they DO have enough money
{
GivePlayerMoney(playerid,-price); // Takes away the money they used
SetPlayerWantedLevel(playerid,0); // Takes away their wanted level
SendClientMessage(playerid,-1,"You are no longer wanted.");
return 1;
}
return 1;
}