[DONE]DUDB : Made Admin System & Everything is working this time withdraw isnt
#1

i have defined everything setuped enumations e.t.c this is my command code :

pawn Код:
dcmd_withdraw(playerid,params[])
{
    if (!udb_Exists(PlayerName(playerid))) return PlayerMsg(playerid,red,"You Must Be Registerd!");
    if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) return PlayerMsg(playerid,red,"You Must Be Logged In!");
    if (strlen(params)==0) return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
    new Amout[255];
    Amout = strval(params);
    if (amout > udb_UserInt(PlayerName(playerid)"BankMoney")) return PlayerMsg(playerid,red,"Invalid Amout!");
    }
    else {
    PlayerMsg(playerid,red,"THX For Useing The Bank!");
    GivePlayerMoney(playerid,strval(params));
    udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
    return 0;
    }
    return 1;
}
these are the errors i get

Код:
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(236) : error 033: array must be indexed (variable "Amout")
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 017: undefined symbol "amout"
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : warning 215: expression has no effect
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 001: expected token: ";", but found ")"
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : error 029: invalid expression, assumed zero
C:\DOCUME~1\ADMINI~1\Desktop\SAMPSE~1\FILTER~1\admin.pwn(237) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Pawn -> case sensitive.

You create a new array: Amout[255] and later on write it without a capital `A`.

You also got one curly brace too much.

Note that you could have seen that yourself by just reading the error messages.

Here`s the correct code:

Код:
dcmd_withdraw(playerid,params[])
{
	if (!udb_Exists(PlayerName(playerid))) 
		return PlayerMsg(playerid,red,"You Must Be Registerd!");
	if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) 
		return PlayerMsg(playerid,red,"You Must Be Logged In!");
	if (strlen(params)==0) 
		return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
	new Amout[255];
	Amout = strval(params);
	if (Amout > udb_UserInt(PlayerName(playerid)"BankMoney")) 
		return PlayerMsg(playerid,red,"Invalid Amout!");
	else {
		PlayerMsg(playerid,red,"THX For Useing The Bank!");
		GivePlayerMoney(playerid,strval(params));
		udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
		return 0;
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by ray187
Pawn -> case sensitive.

You create a new array: Amout[255] and later on write it without a capital `A`.

You also got one curly brace too much.

Note that you could have seen that yourself by just reading the error messages.

Here`s the correct code:

Код:
dcmd_withdraw(playerid,params[])
{
	if (!udb_Exists(PlayerName(playerid))) 
		return PlayerMsg(playerid,red,"You Must Be Registerd!");
	if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0) 
		return PlayerMsg(playerid,red,"You Must Be Logged In!");
	if (strlen(params)==0) 
		return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
	new Amout[255];
	Amout = strval(params);
	if (Amout > udb_UserInt(PlayerName(playerid)"BankMoney")) 
		return PlayerMsg(playerid,red,"Invalid Amout!");
	else {
		PlayerMsg(playerid,red,"THX For Useing The Bank!");
		GivePlayerMoney(playerid,strval(params));
		udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
		return 0;
	}
	return 1;
}
ur telling i dont watch what i write
well
sorry but your script is same as mine same errors
Reply
#4

Right first off no need to get cheeky just as you made another mistake that I didn`t see.

You forget a "," in this line:
if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney"))

Also, as I just noticed - you create Amount as an array allthough you wanna use it for an integer. Remove "[255]".
Reply
#5

Quote:
Originally Posted by ray187
Right first off no need to get cheeky just as you made another mistake that I didn`t see.

You forget a "," in this line:
if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney"))

Also, as I just noticed - you create Amount as an array allthough you wanna use it for an integer. Remove "[255]".
this is my code
pawn Код:
dcmd_withdraw(playerid,params[])
{
    if (!udb_Exists(PlayerName(playerid)))
        return PlayerMsg(playerid,red,"You Must Be Registerd!");
    if (udb_UserInt(PlayerName(playerid),"LoggedIn")== 0)
        return PlayerMsg(playerid,red,"You Must Be Logged In!");
    if (strlen(params)==0)
        return PlayerMsg(playerid,red,"USAGE : '/withdraw howmuch'");
    new Amout;
    Amout = strval(params);
    if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney"))
        return PlayerMsg(playerid,red,"Invalid Amout!");
    else {
        PlayerMsg(playerid,red,"THX For Useing The Bank!");
        GivePlayerMoney(playerid,strval(params));
        udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
        return 0;
    }
}
and il test if it works now...il set the topic name as [Answered] or add that...
Reply
#6

Quote:
Originally Posted by ray187
Right first off no need to get cheeky just as you made another mistake that I didn`t see.

You forget a "," in this line:
if (Amout > udb_UserInt(PlayerName(playerid),"BankMoney"))

Also, as I just noticed - you create Amount as an array allthough you wanna use it for an integer. Remove "[255]".
it works
Reply
#7

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)