-Jigsaw Posted February 7, 2013 Share Posted February 7, 2013 Hallo all, I have put together this simple code which is intended to give me 500k when I call 1085 on the phone. Only problem is that when I type in the number on the phone I am unable to call it or more simply, nothing happens. using GTA;using System;using System.Windows.Forms;Public Class AddTheCash() Inherits Script Public Sub New() BindPhoneNumber("1085", AddressOf AddCash) End Sub Public Sub AddCash() Player.Money += 500000 Game.DisplayText("Cash Added Successfully") End SubEnd Class Thank you in advance! Link to comment Share on other sites More sharing options...
JokersWild Posted February 7, 2013 Share Posted February 7, 2013 BindPhoneNumber is disabled for Windows 7 for the latest scripthookdotnet 1.7.1.7 beta Link to comment Share on other sites More sharing options...
-Jigsaw Posted February 7, 2013 Author Share Posted February 7, 2013 Oh! So, how could I make it? I tried doing it with a bind but still nothing.. BindKey(keys.F5, AddressOf AddCash) Link to comment Share on other sites More sharing options...
JokersWild Posted February 7, 2013 Share Posted February 7, 2013 BindKey works so something must be wrong in the code. I use c# and this is how you would do it: using System;using System.Windows.Forms;using GTA;public class Money : Script{ public Money() { BindKey(Keys.F5, AddCash); } private void AddCash() { Game.LocalPlayer.Character.Money += 500000; }} Link to comment Share on other sites More sharing options...
-Jigsaw Posted February 8, 2013 Author Share Posted February 8, 2013 BindKey works so something must be wrong in the code. I use c# and this is how you would do it: using System;using System.Windows.Forms;using GTA;public class Money : Script{ public Money() { BindKey(Keys.F5, AddCash); } private void AddCash() { Game.LocalPlayer.Character.Money += 500000; }} Hmm, when I press F5 nothing happens.. But to ensure the procedure, I create a new .txt file, paste the code, rename it to .cs and put it inside GTAIV/scripts. Correct? Link to comment Share on other sites More sharing options...
JokersWild Posted February 9, 2013 Share Posted February 9, 2013 correct, verify in the console the script has loaded. Should say "Money.Money loaded" or something Link to comment Share on other sites More sharing options...
-Jigsaw Posted February 9, 2013 Author Share Posted February 9, 2013 yes it does. "2013-02-09 13:02:53 - ...successfully started script 'Money'!". However, when I press F5 nothing happens.. Link to comment Share on other sites More sharing options...
pedro2555 Posted February 11, 2013 Share Posted February 11, 2013 yes it does. "2013-02-09 13:02:53 - ...successfully started script 'Money'!". However, when I press F5 nothing happens.. Try it like this : using System;using System.Windows.Forms;using GTA;public class Money : Script{ public Money() { BindKey(Keys.F5, AddCash); } private void AddCash() { Player.Character.Money += 500000; }} Link to comment Share on other sites More sharing options...
JokersWild Posted February 11, 2013 Share Posted February 11, 2013 (edited) yes it does. "2013-02-09 13:02:53 - ...successfully started script 'Money'!". However, when I press F5 nothing happens.. Try it like this : using System;using System.Windows.Forms;using GTA;public class Money : Script{ public Money() { BindKey(Keys.F5, AddCash); } private void AddCash() { Player.Character.Money += 500000; }} Player is just a shortcut for Game.LocalPlayer, that is not his problem // GTA.Scriptprotected Player Player{ get { return Game.LocalPlayer; }} Better to just call Game.LocalPlayer instead of being too lazy to type it ;D Edited February 12, 2013 by JokersWild Link to comment Share on other sites More sharing options...
pedro2555 Posted February 12, 2013 Share Posted February 12, 2013 (edited) yes it does. "2013-02-09 13:02:53 - ...successfully started script 'Money'!". However, when I press F5 nothing happens.. Try it like this : using System;using System.Windows.Forms;using GTA;public class Money : Script{ public Money() { BindKey(Keys.F5, AddCash); } private void AddCash() { Player.Character.Money += 500000; }} Player is just a shortcut for Game.LocalPlayer, that is not his problem // GTA.Scriptprotected Player Player{ get { return Game.LocalPlayer; }} Better to just call Game.LocalPlayer instead of being too lazy to type it ;D Oh, I see. Didn't know that, but why use a longer name then ? If they are alias from each other there should be no reason to use one instead of the other, and since Player is shorter... (It's not a question of being lazy or not, is a question of time efficiency. The genius is not the guy who invented the wheel, is the one that put it together with other 3. Although he could have invented all 4, he is not lazier, he is wiser.) But have you tried it anyway ? You never know. I use this with no problem, the player gets and loses money as expected. Edited February 12, 2013 by pedro2555 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now