Results 1 to 4 of 4

Thread: MODDING : How to give money to other players.

  1. #1
    Corporal Killer.Pro's Avatar
    Join Date
    Jul 2012
    Location
    belgium
    Posts
    274
    Thanks
    102
    Thanked 213 Times in 141 Posts

    Post MODDING : How to give money to other players.

    Hello mates,
    Today i'm going to show you how to send the money we made to other players...
    It's kinda same as making shop but you need other scripts...
    So to start open the ui_mp/wm_quickmessage.menu...
    Here we made the shop so that you press V+4 you open the shop so we're going to make V+5 givemoney...
    so right under :

    Code:
    		itemDef
    		{
    			name			"window"
    			visible			1
    			rect			16 68 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"4. Shop"
    			decoration
    		}
    		execKey "4" { close quickmessage; open shop }
    you need to make another menu so under that put this code :

    Code:
    		itemDef
    		{
    			name			"window"
    			visible			1
    			rect			16 84 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"5. Givemoney"
    			decoration
    		}
    		execKey "5" { close quickmessage; open givemoney }
    now save it.
    go to ui_mp/scriptmenus/ and make a copy of shop.menu (from last tutorial)
    rename this new copy to givemoney.menu
    in this file all you need is nothing else but this :

    Code:
    #include "ui_mp/menudef.h"
    
    #define ORIGIN_QUICKMESSAGETAB			32 224
    #define ORIGIN_QUICKMESSAGEWINDOW		32 256
    
    {
    	menuDef
    	{
    		name			"givemoney"
    		fullscreen		0
    		rect			0 0 640 480
    		focuscolor		1 1 1 1
    		disablecolor	0 0 0 0
     		style			WINDOW_STYLE_EMPTY
    
    		onOpen
    		{
    			setDvar cl_bypassMouseInput "1"
    		}
    		onClose
    		{
    			setDvar cl_bypassMouseInput "0"
    		}
    
    // WINDOW BACKGROUND
    		itemDef
    		{
    			name			"window_background"
    			visible			1
    			rect			0 0 224 192
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    	 		style			WINDOW_STYLE_FILLED
    			forecolor		1 1 1 1
    			backcolor		0 0 0 0.7975
    			decoration
    		}
    	
    // WINDOW LINES
    		itemDef
    		{
    			name			"window_lines"
    			visible			1
    			rect			3 0 2 187
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			style			WINDOW_STYLE_FILLED
    			backcolor		1 1 1 .125
    			decoration
    		}
    		itemDef
    		{
    			name			"window_lines"
    			visible			1
    			rect			219 0 2 187
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			style			WINDOW_STYLE_FILLED
    			backcolor		1 1 1 .125
    			decoration
    		}
    		itemDef
    		{
    			name			"window_lines"
    			visible			1
    			rect			5 0 214 2
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			style			WINDOW_STYLE_FILLED
    			backcolor		1 1 1 .125
    			decoration
    		}
    		itemDef
    		{
    			name			"window_lines"
    			visible			1
    			rect			3 187 218 2
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			style			WINDOW_STYLE_FILLED
    			backcolor		1 1 1 .125
    			decoration
    		}
    
    // TITLE
    		itemDef
    		{
    			name			"title"
    			visible			1
    			rect			0 0 224 32
    			origin			ORIGIN_QUICKMESSAGETAB
    			style			WINDOW_STYLE_FILLED
    			forecolor		1 1 1 1
    			backcolor		0 0 0 0.7975
    			type			ITEM_TYPE_TEXT
    			text			"Give money"
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textalignx		112
    			textaligny		24
    			textalign		ITEM_ALIGN_CENTER
    			decoration
    		}
    		itemDef
    		{
    			name			"title_quickmessage_gray"
    			visible			1
    			rect			3 3 218 29
    			origin			ORIGIN_QUICKMESSAGETAB
    			style			WINDOW_STYLE_FILLED
    			backcolor		1 1 1 .125
    			decoration
    		}
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 20 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"1. Give 10 $"
    			decoration
    		}
    		execKey "1" { scriptMenuResponse "1"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 36 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"2. Give 50 $"
    			decoration
    		}
    		execKey "2" { scriptMenuResponse "2"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 52 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"3. Give 100 $"
    			decoration
    		}
    		execKey "3" { scriptMenuResponse "3"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 68 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"4. Give 250 $"
    			decoration
    		}
    		execKey "4" { scriptMenuResponse "4"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 84 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"5. Give 500 $"
    			decoration
    		}
    		execKey "5" { scriptMenuResponse "5"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 100 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"6. Give 750 $"
    			decoration
    		}
    		execKey "6" { scriptMenuResponse "6"; close givemoney; }
    
    		itemDef
    		{
    			name			"window"
    			group			ingamebox
    			visible			1
    			rect			16 116 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"7. Give 1000 $"
    			decoration
    		}
    		execKey "7" { scriptMenuResponse "7"; close givemoney; }
    	
    	
    		itemDef
    		{
    			name			"window"
    			visible			1
    			rect			16 148 0 0
    			origin			ORIGIN_QUICKMESSAGEWINDOW
    			forecolor		1 1 1 1
    			textfont		UI_FONT_NORMAL
    			textscale		.24
    			textaligny		8
    			text			"@QUICKMESSAGE_ESC_EXIT"
    			decoration
    		}
    	}
    }
    Now we have to call the responses of givemoney so open up maps/mp/gametypes/_menus.gsc
    at the end of this file you'll see that we called the shop from the last tutorial so under the shop we'll call givemoney function.
    so at the bottom of this file it should be like this :

    Code:
    		{
    			if(menu == game["menu_quickcommands"])
    				maps\mp\gametypes\_quickmessages::quickcommands(response);
    			else if(menu == game["menu_quickstatements"])
    				maps\mp\gametypes\_quickmessages::quickstatements(response);
    			else if(menu == game["menu_quickresponses"])
    				maps\mp\gametypes\_quickmessages::quickresponses(response);
    			else if(menu == game["menu_shop"])
    				maps\mp\gametypes\_quickmessages::shop(response);
    			else if(menu == game["menu_givemoney"])
    				maps\mp\gametypes\_quickmessages::givemoney(response);
    		}
    So now that we've called our function we have to precache it for that we need to open maps/mp/gametypes/_quickmessages.gsc
    in this file at the top we need something like this

    Code:
    init()
    {
    	game["menu_quickcommands"] = "quickcommands";
    	game["menu_quickstatements"] = "quickstatements";
    	game["menu_quickresponses"] = "quickresponses";
    	game["menu_shop"] = "shop";
    	game["menu_givemoney"] = "givemoney";
    
    	precacheMenu(game["menu_quickcommands"]);
    	precacheMenu(game["menu_quickstatements"]);
    	precacheMenu(game["menu_quickresponses"]);
    	precacheMenu(game["menu_shop"]);
    	precacheMenu(game["menu_givemoney"]);
    	precacheHeadIcon("talkingicon");
    }

  2. The Following 2 Users Say Thank You to Killer.Pro For This Useful Post:

    Kangaroo (3rd September 2012),kung foo man (3rd September 2012)

  3. #2
    Corporal Killer.Pro's Avatar
    Join Date
    Jul 2012
    Location
    belgium
    Posts
    274
    Thanks
    102
    Thanked 213 Times in 141 Posts
    Now its time for our scripts..
    in the same file find the function shop(response)
    from the end of this function we'll start new function so at the end of this function put this code.

    Code:
    givemoney(response)
    {
    	switch(response)		
    	{
        case "1":
    
                            if(self.money >= 10)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=10;
                            players[x].money +=10;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 10)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "2":
    
                            if(self.money >= 50)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=50;
                            players[x].money +=50;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 50)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "3":
    
                            if(self.money >= 100)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=100;
                            players[x].money +=100;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 100)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "4":
    
                            if(self.money >= 250)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=250;
                            players[x].money +=250;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 250)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "5":
    
                            if(self.money >= 500)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=500;
                            players[x].money +=500;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 500)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "6":
    
                            if(self.money >= 750)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=750;
                            players[x].money +=750;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 750)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
    
        case "7":
    
                            if(self.money >= 1000)
                            {
                            players = getentarray("player", "classname");
                            aimedplayer = undefined;
                            for(x=0;x < players.size;x++)
                            {
                            if(self islookingat(players[x]))
                            {
                            self.money -=1000;
                            players[x].money +=1000;
                            aimedplayer = players[x]; 
                            }
                            }
                            if(isDefined(aimedplayer))
                            {
                            self iprintlnbold("^1You transferred money to" + aimedplayer.name);
                            aimedplayer iprintlnbold("^1Recieved money from" + self.name);
                            }
                            else
                            {
                            self iprintlnbold("-=^1Aim at the player you want to give your money tO^7=-");
                            }
                            }
    			if(self.money < 1000)
    			{
    			self iprintlnbold("-=^1Not enough moneY^7=-");
    			}
    			break;
                   }
    }
    Well that's it for giving money to mates
    sorry for two texts , forum wasn't accepting too long tutorial
    i hope it helped

  4. The Following 2 Users Say Thank You to Killer.Pro For This Useful Post:

    Kangaroo (3rd September 2012),kung foo man (3rd September 2012)

  5. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Wow, i really like your tutorials

  6. #4
    Corporal Killer.Pro's Avatar
    Join Date
    Jul 2012
    Location
    belgium
    Posts
    274
    Thanks
    102
    Thanked 213 Times in 141 Posts
    Thanks a lot .... i just want many thanks so i am sharing my exp xD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •