Help me !!!!
#1

how can i change this cmd to dialog input:
Код:
CMD:wiretransfer(playerid, params[])
{
	if(PlayerInfo[playerid][pLevel] < 3)
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "   You must be at least level 3!");
		return 1;
	}
	if(!IsPlayerInRangeOfPoint(playerid, 15.0, 2308.7346, -11.0134, 26.7422))
	{
		SendClientMessageEx(playerid, COLOR_GREY, "you are not in a bank");
		return 1;
	}
	if(PlayerInfo[playerid][pCash] < 0 || PlayerInfo[playerid][pAccount] < 0)
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "Your cash on-hand or in the bank is currently at a negative value!");
		return 1;
	}
	if(gettime()-GetPVarInt(playerid, "LastTransaction") < 10) return SendClientMessageEx(playerid, COLOR_GRAD2, "Wait 10s !");
    if(PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playerid, COLOR_GREY, "The Bank Is Close now");
	new string[128], giveplayerid, amount;
	if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessageEx(playerid, COLOR_GREY, "SU DUNG: /wiretransfer [player] [amount]");


	if (IsPlayerConnected(giveplayerid))
	{
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if(gPlayerLogged{giveplayerid} == 0) return SendClientMessageEx(playerid, COLOR_GREY, "* Player Could Be Offline!");
			new playermoney = PlayerInfo[playerid][pAccount] ;
			if (amount > 0 && playermoney >= amount)
			{
				GivePlayerCashEx(playerid, TYPE_BANK, -amount);
				GivePlayerCashEx(giveplayerid, TYPE_BANK, amount);
				/*PlayerInfo[playerid][pAccount] -= amount;
				PlayerInfo[giveplayerid][pAccount] += amount;*/
				format(string, sizeof(string), "   You have send $%s for account %s's.", number_format(amount), GetPlayerNameEx(giveplayerid),giveplayerid);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				SendClientMessageEx(playerid, COLOR_GRAD1, string);
				format(string, sizeof(string), "   You have recive $%s into your account %s.", number_format(amount), GetPlayerNameEx(playerid), playerid);
				SendClientMessageEx(giveplayerid, COLOR_GRAD1, string);
				new ip[32], ipex[32];
				GetPlayerIp(playerid, ip, sizeof(ip));
				GetPlayerIp(giveplayerid, ipex, sizeof(ipex));
				format(string, sizeof(string), "[BANK] %s (IP:%s) da chuyen $%s den %s (IP:%s).", GetPlayerNameEx(playerid), ip, number_format(amount), GetPlayerNameEx(giveplayerid), ipex);

				if(amount >= 500000)
				{
					ABroadCast(COLOR_YELLOW,string,2);
				}
				Log("logs/pay.log", string);
				PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
				SetPVarInt(playerid, "LastTransaction", gettime());

				/*OnPlayerStatsUpdate(playerid);
				OnPlayerStatsUpdate(giveplayerid);*/
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GRAD1, "   Amount Error.");
			}
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Player Could Be offline.");
	return 1;
}
the first dialog we type the ID that player, then the next dialog will appear this dialog we type the ammount of money you want to send to the other player
Reply
#2

bump
Reply
#3

You can bump once in 24 hours.
Reply
#4

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
You can bump once in 24 hours.
oh sorry
Reply
#5

Information

Clearly you have no taken the time to check the tutorial section? There are plenty of tutorials that show you exactly how to do what you are asking.

Create a Dialog
Reply
#6

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Information

Clearly you have no taken the time to check the tutorial section? There are plenty of tutorials that show you exactly how to do what you are asking.

Create a Dialog
but i don't know how to check the ID player we type in the dialog offline or online
Reply
#7

Like this?

PHP код:
#define DIALOG_WIRETRANSFER_PLAYER 1
#define DIALOG_WIRETRANSFER_AMOUNT 2
CMD:wiretransfer(playeridparams[])
{
    if(
PlayerInfo[playerid][pLevel] < 3)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"   You must be at least level 3!");
        return 
1;
    }
    if(!
IsPlayerInRangeOfPoint(playerid15.02308.7346, -11.013426.7422))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"you are not in a bank");
        return 
1;
    }
    if(
PlayerInfo[playerid][pCash] < || PlayerInfo[playerid][pAccount] < 0)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"Your cash on-hand or in the bank is currently at a negative value!");
        return 
1;
    }
    if(
gettime()-GetPVarInt(playerid"LastTransaction") < 10) return SendClientMessageEx(playeridCOLOR_GRAD2"Wait 10s !");
    if(
PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playeridCOLOR_GREY"The Bank Is Close now");
    
ShowPlayerDialog(playeridDIALOG_WIRETRANSFER_PLAYERDIALOG_STYLE_INPUT"Wire Transfer""Please put the valid playerid""Procced""Cancel");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
string[150];
    
    if(
dialogid == DIALOG_WIRETRANSFER_PLAYER)
    {
        if(
response// If they clicked 'Yes' or pressed enter
        
{
            new 
giveplayerid strval(inputtext);
            
            if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive userid!");
            
SetPVarInt(playerid"PlayerSelected"giveplayerid);
            
ShowPlayerDialog(playeridDIALOG_WIRETRANSFER_AMOUNTDIALOG_STYLE_INPUT"Wire Transfer""Please put the amount of money""Transfer""Cancel");
        }
    }
    if(
dialogid == DIALOG_WIRETRANSFER_AMOUNT)
    {
        if(
response// If they clicked 'Yes' or pressed enter
        
{
                new 
amount strval(inputtext);
                new 
giveplayerid GetPVarInt(playerid"PlayerSelected");
                new 
playermoney PlayerInfo[playerid][pAccount] ;
            
                if (
amount && playermoney amount) return SendClientMessageEx(playeridCOLOR_GRAD1"   Amount Error.");
                
GivePlayerCashEx(playeridTYPE_BANK, -amount);
                
GivePlayerCashEx(giveplayeridTYPE_BANKamount);
                
                
PlayerInfo[playerid][pAccount] -= amount;
                
PlayerInfo[giveplayerid][pAccount] += amount;
                
format(stringsizeof(string), "   You have send $%s for account %s's."number_format(amount), GetPlayerNameEx(giveplayerid),giveplayerid);
                
PlayerPlaySound(playerid10520.00.00.0);
                
SendClientMessageEx(playeridCOLOR_GRAD1string);
                
format(stringsizeof(string), "   You have recive $%s into your account %s."number_format(amount), GetPlayerNameEx(playerid), playerid);
                
SendClientMessageEx(giveplayeridCOLOR_GRAD1string);
                new 
ip[32], ipex[32];
                
GetPlayerIp(playeridipsizeof(ip));
                
GetPlayerIp(giveplayeridipexsizeof(ipex));
                
format(stringsizeof(string), "[BANK] %s (IP:%s) da chuyen $%s den %s (IP:%s)."GetPlayerNameEx(playerid), ipnumber_format(amount), GetPlayerNameEx(giveplayerid), ipex);
                if(
amount >= 500000)
                {
                    
ABroadCast(COLOR_YELLOW,string,2);
                }
                
Log("logs/pay.log"string);
                
PlayerPlaySound(giveplayerid10520.00.00.0);
                
SetPVarInt(playerid"LastTransaction"gettime());
        }
    }
    return 
0// You MUST return 0 here! Just like OnPlayerCommandText.

EDIT: Fixed some mistakes.
Reply
#8

yes thank you some thing like that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)