Teach me... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Teach me... (
/showthread.php?tid=165001)
Teach me... -
GaGlets(R) - 03.08.2010
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..
Re: Teach me... -
cofy1 - 03.08.2010
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.");
}
Re: Teach me... -
GaGlets(R) - 03.08.2010
Ah forgot..
I am using sscanf2 and ZCMD ..
I dont thik your strlen usage is right..
Re: Teach me... -
cofy1 - 03.08.2010
I use sscanf and do not have any problem using strlen
Re: Teach me... -
GaGlets(R) - 03.08.2010
bah.. just ansver me - is my style wrongly or right made?
Re: Teach me... -
cofy1 - 03.08.2010
Maybe, try it
Re: Teach me... -
GaGlets(R) - 03.08.2010
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..
Re: Teach me... -
cofy1 - 03.08.2010
Well, paste the command to check all =D
Re: Teach me... -
GaGlets(R) - 03.08.2010
just test it please by yourself with that givecashcommand
Re: Teach me... -
(.Aztec); - 03.08.2010
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.