# Solvedcompare a 4byte adress value in a hook

#### Icew0lf

##### Software Ninjaneer
Dank Tier VIP
Fleep Tier Donator
its a teleport code.

THIS just works fine:

C++:
``````	if (keydown(VK_LSHIFT) && keydown(VK_F1))
{
myptr1 = (Store);
*(float*)(myptr1) = *((float*)(0x12345));
*(float*)(myptr1 + 0x04) = *((float*)(0x12345));
*(float*)(myptr1 + 0x08) = *((float*)(0x12345));
}``````
but now i want to execute it only if a certain adress (which is 4BYTE) have the value of = 1.
so i want to make a comparison.

C++:
``````	if (*(float*)(0x7777777) = 1)
{
myptr1 = (Store);
*(float*)(myptr1) = *((float*)(0x12345));
*(float*)(myptr1 + 0x04) = *((float*)(0x12345));
*(float*)(myptr1 + 0x08) = *((float*)(0x12345));
}``````
if i change the float to BYTE:

C++:
``````	if (*(BYTE*)(0x7777777) = 1)
{
myptr1 = (Store);
*(float*)(myptr1) = *((float*)(0x12345));
*(float*)(myptr1 + 0x04) = *((float*)(0x12345));
*(float*)(myptr1 + 0x08) = *((float*)(0x12345));
}``````
the result is always true, no matter if its 1 or 0 or whatever...it doesnt compare.
how can i compare the 0x7777777 to a 4byte value and execute only if its 1?

thanks to help me to get the basics down
Ice

Last edited:

#### till0sch2

##### Newbie
what you need is ==, not =.

#### Icew0lf

##### Software Ninjaneer
Dank Tier VIP
Fleep Tier Donator
wow thanks a lot till0sch2!!

if (*((BYTE*)(0x12345)) == 1)

solved my problem...ur awesome, saved my day!
i rise the next beer on you! learned something new, thanks!

best regards,
icew0lf

Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language 