[HELP] Need to set limit on this CMD
#1

Hi I need to make this command to not to add more than 1m if someone try to enter a value above 1million it says you cant enter that much ammount the limit is 1m

PHP код:
YCMD:setcontract(playeridparams[], help) { 
    new 
userprice
    new 
faction GetPVarInt(playerid"Faction"); 
    if(
getFactionType(faction) != EFactionType_Hitman || GetPVarInt(playerid"Rank") < 2) { 
        
SendClientMessage(playeridX11_TOMATO_2"You aren't a member of hitman!"); 
        return 
1
    } 
    if(!
sscanf(params"k<playerLookup>d",user,price)) { 
        if(!
IsPlayerConnectEx(user)) { 
            
SendClientMessage(playeridX11_TOMATO_2"User not found"); 
            return 
1
        } 
        
SetPVarInt(user"Contract"price); 
        if(
price != 0) { 
            
SendClientMessage(playeridCOLOR_LIGHTBLUE"* Contract Updated!"); 
        } else { 
            
SendClientMessage(playeridCOLOR_LIGHTBLUE"* Contract Removed!"); 
        } 
    } else { 
        
SendClientMessage(playeridX11_WHITE"USAGE: /setcontract [user] [price]"); 
    } 
    return 
1

Reply
#2

Paste this right after your sscanf-line:
pawn Код:
if (price > 1000000) return SendClientMessage(playerid, X11_TOMATO_2, "Max price is 1 million");
Reply
#3

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
Paste this right after your sscanf-line:
pawn Код:
if (price > 1000000) return SendClientMessage(playerid, X11_TOMATO_2, "Max price is 1 million");
Thanks REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)