[QUESTION] Possible to use 1 variable on 2 uses? - Patrick - 13.02.2013
hello guys. im just gonna ask if i can use this without any conflicting on each other,
is it possible to use 1 variable with 2 uses? example
pawn Код:
new cpandpickup;
public OnGameModeInit()
{
cpandpickup = CreateDynamicCP(1352.294677,-1759.066284,13.507812, 1.5, -1, -1, -1, 75.0);
cpandpickup = CreateDynamicPickup(1318, 2, -30.9822,-92.0099,1003.5469, 0);
return
}
is it gonna conflict? i hope anyone could answer my Question " it is going to conflict? "
Re: [QUESTION] Possible to use 1 variable on 2 uses? -
Roko_foko - 13.02.2013
Yes it is going to conflict. After that part of code you wont be able to know when player enters the Checkpoint. Maybe the more important thing: you won't be able to destroy the checkpoint.
Re: [QUESTION] Possible to use 1 variable on 2 uses? -
HimSelf - 13.02.2013
here ya go,
pawn Код:
new cpandpickup[2];
public OnGameModeInit()
{
cpandpickup[0] = CreateDynamicCP(1352.294677,-1759.066284,13.507812, 1.5, -1, -1, -1, 75.0);
cpandpickup[1] = CreateDynamicPickup(1318, 2, -30.9822,-92.0099,1003.5469, 0);
return 1;
}
Re: [QUESTION] Possible to use 1 variable on 2 uses? - Patrick - 13.02.2013
@ HimSelf i know those, im just asking if its possible so i could use less variables
@Roko_Foko thanks, for the info
Re: [QUESTION] Possible to use 1 variable on 2 uses? -
PrawkC - 13.02.2013
Quote:
Originally Posted by pds2012
@ HimSelf i know those, im just asking if its possible so i could use less variables
@Roko_Foko thanks, for the info
|
Let me explain why it wouldnt work.
Each of those functions return the id of the check point or pickup created, so if you have the variable pie, and assign it to a function, what ever the function returns pie will become, and for later use for manipluation of an item, IE deletion, you requre the id, so if you use the same variable and assign it to a different function the value of pie would change and it would no longer be the value for the other one, thus you couldn't delete it or what ever else by using the variable pie.
Re: [QUESTION] Possible to use 1 variable on 2 uses? -
new121 - 13.02.2013
Quote:
Originally Posted by pds2012
@ HimSelf i know those, im just asking if its possible so i could use less variables
@Roko_Foko thanks, for the info
|
HimSelfs example is still better then creating two separate variables because when you make a variables such as
you are using 64 bits of memory, however with this
you are only using 32 bits of memory if I am not mistaken.