i fixed that yeah it was about the define , but now i got error on this :
(LINE 12284) if(strcmp(MathAnswer, text, false, 14) == 0) { -- if someone entered the math answer server respond to him -- } here is the error : F:\...\FREEROAM.pwn(12284) : error 035: argument type mismatch (argument 1) |
(LINE 12284) if(!strcmp(MathAnswer, text, false))
{
-- if someone entered the math answer server respond to him --
}
// and make sure you defined the matchanswer as string
new MathAnswer[64];
when i define it to string i got this errors again :
F:\...\FREEROAM.pwn(44811) : error 033: array must be indexed (variable "MathAnswer") F:\...\FREEROAM.pwn(44819) : error 033: array must be indexed (variable "MathAnswer") :/ |
MathAnswer = num1+num2;
stock FIX_valstr(dest[], value, bool:pack = false)
{
// format can't handle cellmin properly
static const cellmin_value[] = !"-2147483648";
if (value == cellmin)
pack && strpack(dest, cellmin_value, 12) || strunpack(dest, cellmin_value, 12);
else
format(dest, 12, "%d", value), pack && strpack(dest, dest, 12);
}
#define valstr FIX_valstr
// remove the string and make the matchanswer as int vale
new MathAnswer;
//and in checking player text do this
(LINE 12284) if(strcmp(MathAnswer, text, true, 10))
{
-- if someone entered the math answer server respond to him --
}
// change this line to something like this
if(strval(text) == MatchAnswer)
{
-- if someone entered the math answer server respond to him --
}
stock strval(const string[])
{
new bool:minus, value, index, multiplier = 1, output[25];
if(string[0] == 45) minus = true; // Checking, if there is a "-" character.
if(!minus && !IsNumericChar(string[0])) return 0;
if(minus && !IsNumericChar(string[1])) return 0;
GetNumericPartOfString(string, output, index); // Getting the numeric string part.
for(new i; i<strlen(output) - 1; i++) multiplier *= 10;
for(new i; i<strlen(output); i++, multiplier /= 10) value += (output[i] - 48) * multiplier; // Making a number from it...
return minus ? -value : value; // Returning the final value. If there was "-" character at the begin of string, it will return -value.
}
new MathAnswer[64];
new string1[64];
new sum;
sum = num1+num2;
format(string1,sizeof(string1),"%d",sum);
strcpy(MathAnswer,string1);
thnx its worked
![]() |