Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 6,718 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pointer... need help #447477
12/15/14 04:44
12/15/14 04:44
Joined: Jul 2009
Posts: 85
A
Altarius Offline OP
Junior Member
Altarius  Offline OP
Junior Member
A

Joined: Jul 2009
Posts: 85
Hi,

void Attack(){

if(my.STATE_MACHINE == ATTACK
{
return;
}
my.STATE_MACHINE = ATTACK;
}

it work if i acces this function inside a while loop whit:

if(mouse_left == 1) {Attack();}

it crash if i acces this function outside a while loop whit:

on_mouse_left = Attack;

i think the problem its the pointer "my".
Is there a way too keep the "my" pointer there and use on_mouse_left = Attack; wihtout getting crash...

thx

Re: pointer... need help [Re: Altarius] #447479
12/15/14 10:03
12/15/14 10:03
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Just save the pointer in a self delcared variable:
Code:
ENTITY *pPlayer = NULL; //Global
...
pPlayer = me; //In your entity action



or use the predefined pointer called "player"

Last edited by Ch40zzC0d3r; 12/15/14 10:03.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1