Problem With /givemoney +rep [Please Help Me :( ]
#1

I have a problem on this script, This is very detrimental please help me
**
if the sender gives the money to another player, no problem
however, if the sender gives the money to another player, then the sender leaving the server, the money sender is not reduced, but the money sent to the player targeted

PHP код:
CMD:givemoney(playerid,params[]) {
    new 
moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playermoney[MAX_PLAYERS],string[128];
    if (
sscanf(params"ud",giveplayeridmoneys)) return SendClientMessage(playeridCOLOR_LIGHTBLUE"{FF9900}[USAGE]:- {FFFFFF}/givemoney {FFFF00}[playerid] [amount]");
//    if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
    
if (IsPlayerConnected(giveplayerid)) {
        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
playermoney[playerid] = GetPlayerMoney(playerid);
        if (
moneys && playermoney[playerid] >= moneys) {
            
GivePlayerMoney(playerid, (-moneys));
            
GivePlayerMoney(giveplayeridmoneys);
            
format(stringsizeof(string), "{FFFFFF}You Have Sent {FFFF00}%s [%d], {33CC33}$%d"giveplayer,giveplayeridmoneys);
            
SendClientMessage(playeridCOLOR_GREENstring);
            
format(stringsizeof(string), "{FFFFFF}You have received {33CC33}$%d {FFFFFF}From {FFFF00}%s [%d]"moneyssendernameplayerid);
            
SendClientMessage(giveplayeridCOLOR_GREENstring);
            
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendernameplayeridmoneysgiveplayergiveplayerid);
        }
        else {
            
SendClientMessage(playeridCOLOR_BRIGHTRED"{FF9900}[BANK]:- {FFFFFF}Invalid transaction amount");
        }
    }
    else {
        
format(stringsizeof(string), "{FFFF00}[ID:%d] {FFFFFF}Player not connected!"giveplayerid);
        
SendClientMessage(playeridCOLOR_BRIGHTREDstring);
    }
    return 
1;

Reply
#2

May I see your GivePlayerMonez(); stock/function?
Reply
#3

Show more details if there are other functions related to this command.
Reply
#4

that's script anti money hack Moneyhax https://sampforum.blast.hk/showthread.php?tid=189607
Reply
#5

this should work

PHP код:
CMD:givemoney(playerid,params[]) {
    new 
moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],string[128];
    if (
sscanf(params"ud",giveplayeridmoneys)) return SendClientMessage(playeridCOLOR_LIGHTBLUE"{FF9900}[USAGE]:- {FFFFFF}/givemoney {FFFF00}[playerid] [amount]");
//    if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
    
if (IsPlayerConnected(giveplayerid)) {
        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer)); GetPlayerName(playeridsendernamesizeof(sendername));
        new 
cash[2]; cash[0] = GetPlayerMoney(playerid); cash[1] = GetPlayerMoney(giveplayerid);
        if (
moneys && cash[0] >= moneys) {
            
GivePlayerMoney(playeridcash[0]-moneys);
            
GivePlayerMoney(giveplayerid,cash[1]+moneys);
            
format(stringsizeof(string), "{FFFFFF}You Have Sent {FFFF00}%s [%d], {33CC33}$%d"giveplayer,giveplayeridmoneys);
            
SendClientMessage(playeridCOLOR_GREENstring);
            
format(stringsizeof(string), "{FFFFFF}You have received {33CC33}$%d {FFFFFF}From {FFFF00}%s [%d]"moneyssendernameplayerid);
            
SendClientMessage(giveplayeridCOLOR_GREENstring);
            
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendernameplayeridmoneysgiveplayergiveplayerid);
        }
        else {
            
SendClientMessage(playeridCOLOR_BRIGHTRED"{FF9900}[BANK]:- {FFFFFF}Invalid transaction amount");
        }
    }
    else {
        
format(stringsizeof(string), "{FFFF00}[ID:%d] {FFFFFF}Player not connected!"giveplayerid);
        
SendClientMessage(playeridCOLOR_BRIGHTREDstring);
    }
    return 
1;

Reply
#6

doesn't work
Reply
#7

please help me guys
Reply
#8

Solved with myself
ty
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)