PDA

View Full Version : [Help]Find unknown vaule


Paween12802
07/12/2013, 02:29 PM
Hey Guy is there an idea about ummmmmmmm. << i wanna know the value

This value with my code

new ammo = GetPlayerAmmo(playerid);

if(ammo += x = 7) i mean ammo plus unknown then it equal to seven then find what's x

and i wanna know the x

but when i tried this it not work

please help Thank man

FahadKing07
07/12/2013, 02:36 PM
Wrong Comment (Removed by Fahad)

newbie scripter
07/12/2013, 02:40 PM
@ paween
can i know why u want to get X?
@ Fahad
he asked how to find "x" not about those operators..

Paween12802
07/12/2013, 02:41 PM
noo it not what i'm taking about i meann i wanna find x

Example to my code

if(ammo + [[>X<]] = 7) then find to X

If find X then i wanna use this x to example

SetPlayerHeath(playerid, X)

Like a mathamatic 6+x = 10 [x is 4] <<< like this and i mean i wanna use 4

newbie scripter
07/12/2013, 02:48 PM
ik what u want, but idk where u can gonna use it. anyway i will try to answer ur question..

EDIT: try

new x;
if(ammo += x == 7)
{
x == ammo - 7;
printf(%d, x);
}

Idk whether it works :P

Paween12802
07/12/2013, 02:49 PM
thank Huge Clucker

FahadKing07
07/12/2013, 02:51 PM
Oh u meant that :P

Paween12802
07/12/2013, 02:54 PM
Oh u meant that :P

yeppp mannnn :D

newbie scripter
07/12/2013, 02:55 PM
See my post??

Paween12802
07/12/2013, 03:00 PM
ik what u want, but idk where u can gonna use it. anyway i will try to answer ur question..

EDIT: try

new x;
if(ammo += x == 7)
{
x == ammo - 7;
printf(%d, x);
}

Idk whether it works :P

what u mean by i pretending as 3[ammo] += 4[X] == 7
Then 4 == 3 - 7 <<< this got -4 ??? or whatt Im confusing

newbie scripter
07/12/2013, 03:04 PM
ok then do

new x;
if(ammo += x == 7)
{
x == 7 - ammo;
printf(%d, x);
}


a small mistake :P

Paween12802
07/12/2013, 03:07 PM
ok then do

new x;
if(ammo += x == 7)
{
x == 7 - ammo;
printf(%d, x);
}


a small mistake :P

Im gonna try now

Anyway Thank you for tried :D

Kob Kun Mak Kub <<<< In thai In English >>>> THANK YOU

Paween12802
07/12/2013, 03:12 PM
if(ammo += x == 7) <<< THIS CODE GAVE ME AN tag mismatch how should it be?

Konstantinos
07/12/2013, 03:22 PM
new
x
;

x = ( 7 - ammo > 0 ) ? ( 7 - ammo ) : -1;
if( x != -1 )
{
// do your code with x...
}

Loot
07/12/2013, 03:56 PM
It's a simple math question, you need to swap the parameters in order to solve it.

[ammo + x = 7]

(ammo - 7 = x)


new x = GetPlayerAmmo(playerid) - 7;
printf("The difference between the ammo and the number 7 (x) is: %d", x);

AmigaBlizzard
07/12/2013, 07:22 PM
Don't you mean:

[ammo + x = 7]

Then

[x = 7 - ammo]
?

Steps in between:
ammo + x = 7
ammo - ammo + x = 7 - ammo (here we remove ammo from both sides of the "=" sign by substracting it)

"ammo - ammo" equals to 0, so can be left out, resulting in

x = 7 - ammo


Easy to confirm:
Suppose ammo = 5

ammo + x = 7
5 + x = 7 (x should be 2, right?)

x = 7 - ammo
x = 7 - 5 = 2

There you go.