Problem with GetPlayerMoney and dini_IntSet
#1

hi i'm current making my script.
the problem is i get some error at this part

pawn Код:
//This is from OnDialogResponse

/* DIALOG_BANKW */

if(GetPlayerMoney(playerid) > inputtext) return SendClientMessage(playerid, -1, "You do not have enough cash to withdraw that cash!"); //the problem is here
dini_IntSet(file, "WithDraw", inputtext); //the problem is here too!
error

Код:
error 033: array must be indexed (variable "inputtext")
error 035: argument type mismatch (argument 3)
help ASAP.
Reply
#2

Try:
pawn Код:
if(GetPlayerMoney(playerid) > strval(inputtext)) return SendClientMessage(playerid, -1, "You do not have enough cash to withdraw that cash!");
dini_IntSet(file, "WithDraw", strval(inputtext));
Reply
#3

Quote:
Originally Posted by Reklez
Посмотреть сообщение
hi i'm current making my script.
the problem is i get some error at this part

pawn Код:
//This is from OnDialogResponse

/* DIALOG_BANKW */

if(GetPlayerMoney(playerid) > inputtext) return SendClientMessage(playerid, -1, "You do not have enough cash to withdraw that cash!"); //the problem is here
dini_IntSet(file, "WithDraw", inputtext); //the problem is here too!
error

Код:
error 033: array must be indexed (variable "inputtext")
error 035: argument type mismatch (argument 3)
help ASAP.

inputtext is a string and you are trying to save string with dini_setint, you must first convert string to integar with strval()... This means u r checking if int is greater than string : hope u understand .

Try this


pawn Код:
new money = strval(inputtext);//convert string to int
if(GetPlayerMoney(playerid) < money) return SendClientMessage(playerid, -1, "You do not have enough cash to withdraw that cash!");

dini_IntSet(file, "WithDraw", money);
Reply
#4

thanks Shabi and Andi rep+ both for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)