Little help please. - 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: Little help please. (
/showthread.php?tid=639782)
Little help please. -
Puff - 23.08.2017
Код:
YCMD:setcontract(playerid, params[], help) {
new user, price;
new faction = GetPVarInt(playerid, "Faction");
if(getFactionType(faction) != EFactionType_Hitman || GetPVarInt(playerid, "Rank") < 2) {
SendClientMessage(playerid, X11_TOMATO_2, "You aren't a member of hitman!");
return 1;
}
if(!sscanf(params, "k<playerLookup>d",user,price)) {
if(!IsPlayerConnectEx(user)) {
SendClientMessage(playerid, X11_TOMATO_2, "User not found");
return 1;
}
SetPVarInt(user, "Contract", price);
if(price != 0) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Updated!");
} else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Removed!");
}
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /setcontract [user] [price]");
}
return 1;
}
Hey, how do I restrict the price user enters. like I want maximum price to be entered by user is 100,000 not more than that.. thanks in advance
Re: Little help please. -
thegamer355 - 23.08.2017
That's pretty simple,
if the value "price" is the amount the user enters:
pawn Код:
if(price > 100000) return SendClientMessage(playerid, -1, "You can't enter an amount higher than 100,000);
Re: Little help please. -
FuNkYTheGreat - 23.08.2017
Код:
YCMD:setcontract(playerid, params[], help) {
new user, price;
new faction = GetPVarInt(playerid, "Faction");
if(getFactionType(faction) != EFactionType_Hitman || GetPVarInt(playerid, "Rank") < 2) {
SendClientMessage(playerid, X11_TOMATO_2, "You aren't a member of hitman!");
return 1;
}
if(!sscanf(params, "k<playerLookup>d",user,price)) {
if(!IsPlayerConnectEx(user)) {
SendClientMessage(playerid, X11_TOMATO_2, "User not found");
return 1;
}
if price > 100000) return SendClientMessage(playerid, -1, "MAXIMUM amount of money is 100000.");
SetPVarInt(user, "Contract", price);
if(price != 0) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Updated!");
} else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Removed!");
}
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /setcontract [user] [price]");
}
return 1;
}
OT: i am late ;p
Re: Little help please. -
Puff - 23.08.2017
Thank you so much +REP for you both