Help please thanks.
#1

PHP код:
YCMD:pay(playeridparams[], help) {
    new 
playamoneystring[128];
    if(
help) {
        
SendClientMessage(playeridX11_WHITE"Gives a player money");
        return 
1;
    }
    if(!
sscanf(params"k<playerLookup>d"playamoney)) {
        if(!
IsPlayerConnectEx(playa)) {
            
SendClientMessage(playeridX11_RED_2"User not found!");
            return 
1;
        }
        if(
playa == playerid) {
            
SendClientMessage(playeridX11_WHITE"You cannot give money to yourself");
            return 
1;
        }
        if(
GetPVarInt(playerid"ConnectTime") < 25) {
            
SendClientMessage(playeridX11_TOMATO_2"You must be over 25 connect time to do this!");
            return 
1;
        }
        if(
money || money >= 5000000) {
            
SendClientMessage(playeridX11_WHITE"Invalid Amount");
            return 
1;
        }
        if(
GetMoneyEx(playerid) < money) {
            
SendClientMessage(playeridX11_RED_2"You do not have enough money");
            return 
1;
        }
        new 
Float:X,Float:Y,Float:Z;
        
GetPlayerPos(playaXYZ);
        if(!
IsPlayerInRangeOfPoint(playerid,5.0,XYZ)) {
            
SendClientMessage(playeridX11_TOMATO_2"You are not near this player");
            return 
1;
        }
        
format(stringsizeof(string), "* You gave $%s to %s."getNumberString(money), GetPlayerNameEx(playaENameType_RPName));
        
SendClientMessage(playeridCOLOR_LIGHTGREENstring);
        
format(stringsizeof(string), "* You have received $%s from %s."getNumberString(money), GetPlayerNameEx(playeridENameType_RPName));
        
SendClientMessage(playaCOLOR_LIGHTGREENstring);
        
format(stringsizeof(string), "* %s takes out some cash, and hands it to %s."GetPlayerNameEx(playeridENameType_RPName) ,GetPlayerNameEx(playaENameType_RPName));
        
ProxMessage(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
SetPlayerChatBubble(playeridstringCOLOR_PURPLE3.05000);
        
format(stringsizeof(string), "%s pays %s %d",GetPlayerNameEx(playeridENameType_CharName), GetPlayerNameEx(playeridENameType_CharName), money);
        
payLog(string);
        if(
money 19999 && GetPVarInt(playerid"ConnectTime") < 50 || money 49999)
        {
            
format(stringsizeof(string), "Possible Money Farming: %s has paid $%s to %s."GetPlayerNameEx(playeridENameType_CharName), getNumberString(money), GetPlayerNameEx(playaENameType_CharName));
            
ABroadcast(COLOR_YELLOW,stringEAdminFlags_BasicAdmin);
        }
        
GiveMoneyEx(playerid, -money);
        
GiveMoneyEx(playamoney);
    } else {
        
SendClientMessage(playeridX11_WHITE"USAGE: /pay [playerid/name] [amount]");
    }
    return 
1;

I want to add if the player is below 25 ph.. he can only pay max amount of $1000 each time he enter cmd like /pay [id] 1000... like restriction
Reply
#2

PHP код:
if(GetPlayerHealth(playerid) < 25)
{
//restrict code here
return 1;

Reply
#3

PHP код:
YCMD:pay(playeridparams[], help) { 
    new 
playamoneystring[128]; 
    if(
help) { 
        
SendClientMessage(playeridX11_WHITE"Gives a player money"); 
        return 
1
    } 
    if(!
sscanf(params"k<playerLookup>d"playamoney)) { 
        if(!
IsPlayerConnectEx(playa)) { 
            
SendClientMessage(playeridX11_RED_2"User not found!"); 
            return 
1
        } 
        if(
playa == playerid) { 
            
SendClientMessage(playeridX11_WHITE"You cannot give money to yourself"); 
            return 
1
        } 
        if(
GetPVarInt(playerid"ConnectTime" 25) &&  money 1000) { //changes has been made here
            
SendClientMessage(playeridX11_TOMATO_2"You must be over 25 connect time to do this!"); 
            return 
1
        } 
        if(
money || money >= 5000000) { 
            
SendClientMessage(playeridX11_WHITE"Invalid Amount"); 
            return 
1
        } 
        if(
GetMoneyEx(playerid) < money) { 
            
SendClientMessage(playeridX11_RED_2"You do not have enough money"); 
            return 
1
        } 
        new 
Float:X,Float:Y,Float:Z
        
GetPlayerPos(playaXYZ); 
        if(!
IsPlayerInRangeOfPoint(playerid,5.0,XYZ)) { 
            
SendClientMessage(playeridX11_TOMATO_2"You are not near this player"); 
            return 
1
        } 
        
format(stringsizeof(string), "* You gave $%s to %s."getNumberString(money), GetPlayerNameEx(playaENameType_RPName)); 
        
SendClientMessage(playeridCOLOR_LIGHTGREENstring); 
        
format(stringsizeof(string), "* You have received $%s from %s."getNumberString(money), GetPlayerNameEx(playeridENameType_RPName)); 
        
SendClientMessage(playaCOLOR_LIGHTGREENstring); 
        
format(stringsizeof(string), "* %s takes out some cash, and hands it to %s."GetPlayerNameEx(playeridENameType_RPName) ,GetPlayerNameEx(playaENameType_RPName)); 
        
ProxMessage(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
        
SetPlayerChatBubble(playeridstringCOLOR_PURPLE3.05000); 
        
format(stringsizeof(string), "%s pays %s %d",GetPlayerNameEx(playeridENameType_CharName), GetPlayerNameEx(playeridENameType_CharName), money); 
        
payLog(string); 
        if(
money 19999 && GetPVarInt(playerid"ConnectTime") < 50 || money 49999
        { 
            
format(stringsizeof(string), "Possible Money Farming: %s has paid $%s to %s."GetPlayerNameEx(playeridENameType_CharName), getNumberString(money), GetPlayerNameEx(playaENameType_CharName)); 
            
ABroadcast(COLOR_YELLOW,stringEAdminFlags_BasicAdmin); 
        } 
        
GiveMoneyEx(playerid, -money); 
        
GiveMoneyEx(playamoney); 
    } else { 
        
SendClientMessage(playeridX11_WHITE"USAGE: /pay [playerid/name] [amount]"); 
    } 
    return 
1

Reply
#4

Quote:
Originally Posted by Kinta
Посмотреть сообщение
PHP код:
if(GetPlayerHealth(playerid) < 25)
{
//restrict code here
return 1;

lmao wot
Reply
#5

Quote:
Originally Posted by Zedder
Посмотреть сообщение
PHP код:
YCMD:pay(playeridparams[], help) { 
    new 
playamoneystring[128]; 
    if(
help) { 
        
SendClientMessage(playeridX11_WHITE"Gives a player money"); 
        return 
1
    } 
    if(!
sscanf(params"k<playerLookup>d"playamoney)) { 
        if(!
IsPlayerConnectEx(playa)) { 
            
SendClientMessage(playeridX11_RED_2"User not found!"); 
            return 
1
        } 
        if(
playa == playerid) { 
            
SendClientMessage(playeridX11_WHITE"You cannot give money to yourself"); 
            return 
1
        } 
        if(
GetPVarInt(playerid"ConnectTime" 25) &&  money 1000) { //changes has been made here
            
SendClientMessage(playeridX11_TOMATO_2"You must be over 25 connect time to do this!"); 
            return 
1
        } 
        if(
money || money >= 5000000) { 
            
SendClientMessage(playeridX11_WHITE"Invalid Amount"); 
            return 
1
        } 
        if(
GetMoneyEx(playerid) < money) { 
            
SendClientMessage(playeridX11_RED_2"You do not have enough money"); 
            return 
1
        } 
        new 
Float:X,Float:Y,Float:Z
        
GetPlayerPos(playaXYZ); 
        if(!
IsPlayerInRangeOfPoint(playerid,5.0,XYZ)) { 
            
SendClientMessage(playeridX11_TOMATO_2"You are not near this player"); 
            return 
1
        } 
        
format(stringsizeof(string), "* You gave $%s to %s."getNumberString(money), GetPlayerNameEx(playaENameType_RPName)); 
        
SendClientMessage(playeridCOLOR_LIGHTGREENstring); 
        
format(stringsizeof(string), "* You have received $%s from %s."getNumberString(money), GetPlayerNameEx(playeridENameType_RPName)); 
        
SendClientMessage(playaCOLOR_LIGHTGREENstring); 
        
format(stringsizeof(string), "* %s takes out some cash, and hands it to %s."GetPlayerNameEx(playeridENameType_RPName) ,GetPlayerNameEx(playaENameType_RPName)); 
        
ProxMessage(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
        
SetPlayerChatBubble(playeridstringCOLOR_PURPLE3.05000); 
        
format(stringsizeof(string), "%s pays %s %d",GetPlayerNameEx(playeridENameType_CharName), GetPlayerNameEx(playeridENameType_CharName), money); 
        
payLog(string); 
        if(
money 19999 && GetPVarInt(playerid"ConnectTime") < 50 || money 49999
        { 
            
format(stringsizeof(string), "Possible Money Farming: %s has paid $%s to %s."GetPlayerNameEx(playeridENameType_CharName), getNumberString(money), GetPlayerNameEx(playaENameType_CharName)); 
            
ABroadcast(COLOR_YELLOW,stringEAdminFlags_BasicAdmin); 
        } 
        
GiveMoneyEx(playerid, -money); 
        
GiveMoneyEx(playamoney); 
    } else { 
        
SendClientMessage(playeridX11_WHITE"USAGE: /pay [playerid/name] [amount]"); 
    } 
    return 
1

+REP thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)