Cmd not working well
#1

pawn Код:
CMD:takebizmoney(playerid, params[])
{
new kiek;
new msg[68];

format(bizfile,sizeof(bizfile),"Business/%i.ini",GetPlayerBusinessID(playerid));


for(new i = 0;i<MAX_BUSS;i++)
{

if(sscanf(params, "i", kiek)) return SendClientMessage(playerid,COLOR_GREY,"[Naudojimas]: /takebizmoney [how much]");


if(dini_Int(bizfile, "Bizmoney") < kiek)
{
   SendClientMessage(playerid, COLOR_GREY, "ur biz dont have so much money");
   return 1;
}

if(!IsNumeric(params))
{
   SendClientMessage(playerid, COLOR_GREY, "wrong letters");
   return 1;
}

BusinessInfo[i][Bizmoney]-=kiek;
GivePlayerMoney(playerid,kiek);

format(msg,sizeof(msg),"tooked %i$",kiek);
SendClientMessage(playerid, COLOR_WHITE, msg);
}
return 1;
}
Whats wrong? When i type /takebiz money amount, server spams to me that amount and gives bad amount... I think something is with new i. This command should take player biz money
Reply
#2

You don't need the loop and sscanf already checks IsNumeric

pawn Код:
CMD:takebizmoney(playerid, params[])
{
    new kiek;
    new msg[68];
    format(bizfile,sizeof(bizfile),"Business/%i.ini",GetPlayerBusinessID(playerid));
    if(sscanf(params, "i", kiek)) return SendClientMessage(playerid,COLOR_GREY,"[Naudojimas]: /takebizmoney [how much]");
    if(dini_Int(bizfile, "Bizmoney") < kiek)
    {
        SendClientMessage(playerid, COLOR_GREY, "ur biz dont have so much money");
        return 1;
    }
    BusinessInfo[i][Bizmoney]-=kiek;
    GivePlayerMoney(playerid,kiek);
    format(msg,sizeof(msg),"tooked %i$",kiek);
    SendClientMessage(playerid, COLOR_WHITE, msg);
    return 1;
}
Reply
#3

error 017: undefined symbol "i"
Reply
#4

pawn Код:
CMD:takebizmoney(playerid, params[])
{
    new kiek;
    new msg[68];
    new bizid = GetPlayerBusinessID(playerid);
    format(bizfile,sizeof(bizfile),"Business/%i.ini",bizid);
    if(sscanf(params, "i", kiek)) return SendClientMessage(playerid,COLOR_GREY,"[Naudojimas]: /takebizmoney [how much]");
    if(BusinessInfo[bizid][Bizmoney] < kiek)
    {
        SendClientMessage(playerid, COLOR_GREY, "ur biz dont have so much money");
        return 1;
    }
    BusinessInfo[bizid][Bizmoney]-=kiek;
    GivePlayerMoney(playerid,kiek);
    dini_IntSet(bizfile, "Bizmoney", BusinessInfo[bizid][Bizmoney]);
    format(msg,sizeof(msg),"tooked %i$",kiek);
    SendClientMessage(playerid, COLOR_WHITE, msg);
    return 1;
}
Reply
#5

Thanks, works. But now not - money from bussiness

pawn Код:
BusinessInfo[bizid][Bizmoney]-=kiek;
Reply
#6

Quote:
Originally Posted by jaksimaksi
Посмотреть сообщение
Thanks, works. But now not - money from bussiness

pawn Код:
BusinessInfo[bizid][Bizmoney]-=kiek;
How do you know?
Reply
#7

I tested it. Gives the money but not - from bussiness
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)