DUDB : Made Admin System & Everything is working fine exept deposit
#1

well... this is what i got so far with the deposit cmd...

( im useing dcmd its the best ! )

pawn Код:
dcmd_deposit(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 : '/deposit howmuch'");
    if (!GetPlayerMoney(playerid) >= strval(params)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
    GivePlayerMoney(playerid,-strval(params));
    udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")+strval(params));
    return 1;
}
by this line :

[in case 212 by me ]
pawn Код:
if (!GetPlayerMoney(playerid) >= strval(params)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
i get this warrning :

Код:
C:\Users\Mihailo\Desktop\Script Test Server\filterscripts\admin.pwn(212) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#2

Quote:
Originally Posted by Micko9
well... this is what i got so far with the deposit cmd...

( im useing dcmd its the best ! )

pawn Код:
dcmd_deposit(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 : '/deposit howmuch'");
    if (!GetPlayerMoney(playerid) >= strval(params)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
    GivePlayerMoney(playerid,-strval(params));
    udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")+strval(params));
    return 1;
}
by this line :

[in case 212 by me ]
pawn Код:
if (!GetPlayerMoney(playerid) >= strval(params)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
i get this warrning :

Код:
C:\Users\Mihailo\Desktop\Script Test Server\filterscripts\admin.pwn(212) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
if (GetPlayerMoney(playerid) >= strval(params)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
Try this.
Reply
#3

pawn Код:
if (strval(params) > GetPlayerMoney(playerid)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
dcmd isn't the best, zcmd is.
Reply
#4

Quote:
Originally Posted by KnooL
pawn Код:
if (strval(params) > GetPlayerMoney(playerid)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
dcmd isn't the best, zcmd is.
i think this is what i wanted ( >= ) not >
becouse
its actually...well i want if he has the so much or more it deposits
im makeing the system so that you can deposit anywhere and withdraw anywhere but idk the defination for zcmd...is it easy to use
Reply
#5

Quote:
Originally Posted by KnooL
pawn Код:
if (strval(params) > GetPlayerMoney(playerid)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
dcmd isn't the best, zcmd is.
pawn Код:
dcmd_deposit(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 : '/deposit howmuch'");
    if (strval(params) >= GetPlayerMoney(playerid)) {
    PlayerMsg(playerid,red,"THX For Useing The Bank!");
    GivePlayerMoney(playerid,-strval(params));
    udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")+strval(params));
    }
    else {
    PlayerMsg(playerid,red,"Not Enough Money >_<");
    return 0;
    }
    return 1;
}

    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 : '/deposit howmuch'");
    if (strval(params) >= GetPlayerMoney(playerid)) {
    PlayerMsg(playerid,red,"THX For Useing The Bank!");
    GivePlayerMoney(playerid,strval(params));
    udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")-strval(params));
    }
    else {
    PlayerMsg(playerid,red,"Not Enough Money In The Bank >_<");
    return 0;
    }
    return 1;
}
when i get ingame register & login this happens to me :
-i have some money
-typed /deposit 1000000
-didng have 1000000
-it deposited it to my account and...the lol is i got -100000 cash

help?
Reply
#6

> is above the amount you have: for example, /deposit 2 (you have only 1)
>= is equal to or above the amount you have: for example, /deposit 1 (you have only 1$, you can't deposit it because it is equal to the amount given. (=) )

DCMD is called in OnPlayerCommandText
ZCMD is called directly.

More information: http://forum.sa-mp.com/index.php?topic=116240.0

--

Also I'd advise you to use sscanf in dcmd or zcmd. It's always better as it has it's in-build isnull checker

--

sscanf code <-- --> untested but should work

--

pawn Код:
dcmd_deposit(playerid,params[])
{
new amount;
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(sscanf(params,"d",amount)) return PlayerMsg(playerid,red,"USAGE : '/deposit howmuch'");
else if (GetPlayerMoney(playerid) < amount) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
else {
GivePlayerMoney(playerid,-amount);
udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")+amount); }
return 1;
}
}
Reply
#7

Quote:
Originally Posted by KnooL
> is above the amount you have: for example, /deposit 2 (you have only 1)
>= is equal to or above the amount you have: for example, /deposit 1 (you have only 1$, you can't deposit it because it is equal to the amount given. (=) )

DCMD is called in OnPlayerCommandText
ZCMD is called directly.

More information: http://forum.sa-mp.com/index.php?topic=116240.0

--



Also I'd advise you to use sscanf in dcmd or zcmd. It's always better as it has it's in-build isnull checker

--

sscanf code <-- --> untested but should work

--

pawn Код:
dcmd_deposit(playerid,params[])
{
new amount;
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(sscanf(params,"d",amount)) return PlayerMsg(playerid,red,"USAGE : '/deposit howmuch'");
else if (GetPlayerMoney(playerid) < amount) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
else {
GivePlayerMoney(playerid,-amount);
udb_UserSetInt(PlayerName(playerid),"BankMoney",udb_UserInt(PlayerName(playerid),"BankMoney")+amount); }
return 1;
}
}
ugh i already done it and i was tired that night.... i could understand a thing now i understand everything
Reply
#8

Quote:
Originally Posted by KnooL
pawn Код:
if (strval(params) > GetPlayerMoney(playerid)) return PlayerMsg(playerid,red,"Invalid Amout. You Dont Have So Much!");
dcmd isn't the best, zcmd is.
withdraw aint working deposit is now

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)