Strings and Numbers
#1

I have a long number, 674583948
I tried to use modifiers for variable but failed. When i tried to assign it directly to a variable

pawn Код:
new var = 674583948;
But it displayed some other number when i printed it. Then I tried to assign it to a string.

pawn Код:
new str[15];
format(str, 15, "674583948");
Then I tried to compare it with 777 and check if that number is equal using

pawn Код:
if(!strcmp(str, "777", true))
{
    //blah blah code here....
}
But the comparison always returns 0 which makes it enter the if condition.

How do I compare the numbers?
Reply
#2

if(Number == OtherNumber)
{

}
Reply
#3

Quote:

if(Number == OtherNumber)
{

}

The problem is I cant get the 'Number' parameter which is a long integer.
I had to pack it to a string, otherwise a long number is reduced to 2 digits. And strval is returning some other number (strval should and will return some other number. I know that).
Reply
#4

This is how I fetch the line
pawn Код:
sscanf(fetchline, "p<|>ds[24]i", var[0], str[0], var[1]);
This is the Mysql Log:
Код:
CMySQLHandler::FetchRow() - Return: 364|DeaL|5587523124
This is how it prints the number:

pawn Код:
printf("%i", var[1]);
1292555828
Reply
#5

Sorry, didnt know about the cell limit. So if my number is 558752312 will it work?
Reply
#6

Quote:
Originally Posted by deather
Посмотреть сообщение
Sorry, didnt know about the cell limit. So if my number is 558752312 will it work?
Yes because it is between cellmin(-2^31) and cellmax (2^31 - 1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)