OnPlayerText & some code issue
#1

------
Reply
#2

1st: You have to return 0 at onplayertext to avoid the native message from being sent if you use custom messages.
2nd: bMoney variable might not be correctly set. Make a debug and check what BussinessInfo[b][bMoney] returns.
Reply
#3

As for the first issue, you should return [0] under OnPlayerText so that it doesn't send the original text and send your modified one only.

For the second issue, it's not too clear to me, you gotta tell more about this business system maybe. I think it's about the way you coded your command /vault withdraw but I'm not so sure. Can you show the whole code of this command?
Reply
#4

------
Reply
#5

------
Reply
#6

------
Reply
#7

------
Reply
#8

No offence to no one but that's a terrible code...
Reply
#9

------
Reply
#10

try this out, I have no idea if it will work, This code gave me a head ache anyways here
pawn Код:
if(strcmp(x_op,"withdraw",true) == 0)
    {
        for(new b = 1; b < sizeof(BusinessInfo); b++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[b][bExitX], BusinessInfo[b][bExitY], BusinessInfo[b][bExitZ] && BusinessInfo[b][bOwned] == 1 && strcmp(BusinessInfo[b][bOwner], sendername(playerid), false))
            {
                MSG(playerid,RED,"[ERROR] You don't own this business.");
            else
            {
                new string[100],amount;
                if(sscanf(params,"i",amount)) return MSG(playerid,GRAD,"/vault withdraw [Amount]");
                if(BusinessInfo[b][bMoney] >= amount)
            {
                GivePlayerMoney(playerid,amount);
                BusinessInfo[b][bMoney] -= amount;
                format(string, sizeof(string), "[INFO]{FFFFFF}: You have successfully taken $%d from your vault.", amount);
                SendClientMessage(playerid,GRAD, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)