Teach me...
#1

Doh.. all times i had wrongly scripting dcmds/zcmds etc wtih sscanf..

Now i want to do it right..

How rightly need to use params[]

Like this?
pawn Код:
if(sscanf(params, "i", param[1])) return blabla message // param [1]

GivePlayerMoney(playerid,params[0]); // there need to be param[0] instead of - sscanf it have [1] ?
Till this time i allways defined new variables..
Reply
#2

pawn Код:
dcmd_money(playerid,params[]) {
    if(IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /money <cash>");
        {
            GivePlayerMoney(playerid, params);
            return 0;
        }
    } else return SendClientMessage(playerid,red,"ERROR: You can't use this command.");
}
Reply
#3

Ah forgot..

I am using sscanf2 and ZCMD ..

I dont thik your strlen usage is right..
Reply
#4

I use sscanf and do not have any problem using strlen
Reply
#5

bah.. just ansver me - is my style wrongly or right made?
Reply
#6

Maybe, try it
Reply
#7

Quote:
Originally Posted by cofy1
Посмотреть сообщение
Maybe, try it
Just hate to try..

I allways got crashed PC after that.. If something goes wrong - need to restart - restart injuring PC - injured PC will die..
Reply
#8

Well, paste the command to check all =D
Reply
#9

just test it please by yourself with that givecashcommand
Reply
#10

Give cash command? (Sorry, didn't read any replies..)

pawn Код:
new user, amount;
if(!sscanf(params, "ui", user, amount))
{
if(user != INVALID_PLAYER_ID)
{
GivePlayerMoney(user, amount);
}
return 1;
}
Sorry, I couldn't indent using the quick-reply box on the forum.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)