Which way better?
#1

Should i use this:
pawn Код:
dcmd_pasiimti(playerid, params[])
{
    if(logged[playerid] == 1)
    {
    new kiekis, bmoney, bbmoney, bvardas[MAX_PLAYER_NAME], rfile[128], abznt[128],abzntA[128];
    if (sscanf(params, "d",kiekis)) return SendClientMessage(playerid, red, "*** Naudojimas: \"/pasiimti <kiekis>\"");
    if(PlayerToPoint(10,playerid,-2460.8428,133.1277,35.1719) || PlayerToPoint(10,playerid,2121.4131,1486.5015,10.8203) || PlayerToPoint(10,playerid,1721.8575,-1654.8584,20.9688) || PlayerToPoint(10,playerid,-1954.4741,-826.1263,35.8909) || PlayerToPoint(10,playerid,941.3055,1733.2744,8.8516) || PlayerToPoint(10,playerid,310.1612,-1515.8033,24.9219))
    {
    GetPlayerName(playerid,bvardas,sizeof(bvardas));
    format(rfile,sizeof(rfile), "%s.ini", bvardas);
    bmoney = dini_Int(rfile, "bankas");
    bbmoney = dini_Int(rfile, "money");
    if(kiekis <= bmoney && kiekis > 0)
    {
    dini_IntSet(rfile, "bankas", bmoney-kiekis);
    dini_IntSet(rfile, "money", bbmoney + kiekis);
    pMoney[playerid] = (pMoney[playerid]+kiekis);
    format(abznt,sizeof(abznt),"*** Pasiemei is savo banko saskaitos %d$",kiekis);
    format(abzntA,sizeof(abzntA),"*** Galutinis banko saskaitos likutis %d$",bmoney-kiekis);
    SendClientMessage(playerid,yellow,abznt);
    SendClientMessage(playerid,yellow,abzntA);
    }
    else { SendClientMessage(playerid,blue,"*** Neteisingai ivesta suma."); }
    } else{ SendClientMessage(playerid, balta, "*** Nuvaziuok iki banko."); }
    } else{ SendClientMessage(playerid, balta, "SERVER: Unknown command."); }
    return 1;
}
or should I make those variables on top of script:
pawn Код:
new kiekis, bmoney, bbmoney, bvardas[MAX_PLAYER_NAME], rfile[128], abznt[128],abzntA[128];
?
I know that works both ways, but which is better? Or maybe there is no difference?
Reply
#2

Adding them in a function/command destroys them as soon as the function/command has ended, Adding them to the top of script makes them Create when you start the server and Destroy when you exit it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)