SA-MP Forums Archive
What i have wrong here - 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)
+--- Thread: What i have wrong here (/showthread.php?tid=543593)



What i have wrong here - Dezzzy - 27.10.2014

HTML Code:
	if (strcmp("/Money", cmdtext, true, 10) == 0)
	{
		GivePlayerMoney(playerid, money);
		return 1;
	}
	return 0;
Error
HTML Code:
C:\Users\Gigi\Desktop\America Life\gamemodes\tutorial.pwn(103) : error 017: undefined symbol "money"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 103 >>>>GivePlayerMoney(playerid, money);


Re: What i have wrong here - Sew_Sumi - 27.10.2014

Quote:
Originally Posted by Dezzzy
View Post
Error
HTML Code:
C:\Users\Gigi\Desktop\America Life\gamemodes\tutorial.pwn(103) : error 017: undefined symbol "money"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 103 >>>>GivePlayerMoney(playerid, money);
money isn't defined and you are using it.

The example you post assumes that money will be set.

You could put
HTML Code:
new money = 10000;
at the top of the script and that'd make, money, work.


Re: What i have wrong here - DavidBilla - 27.10.2014

Instead of 'money', write the amount of money you want. For example '100000', Ofcourse without quote


Re: What i have wrong here - Dezzzy - 27.10.2014

David it works but i want like , when i type money id and amount .. not only 10000


Re: What i have wrong here - dominik523 - 27.10.2014

Read this:
https://sampforum.blast.hk/showthread.php?tid=473769


Re: What i have wrong here - DavidBilla - 27.10.2014

Then using sscanf would help

pawn Code:
if (strcmp("/Money", cmdtext, true,6) == 0)
{
    new id,amount;
    if(sscanf(cmdtext[7],"ui",id,amount)) return SendClientMessage(playerid,-1,"USAGE:/Money [id] [amount]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Invalid player");
    GivePlayerMoney(id,amount);
}



Re: What i have wrong here - Glossy42O - 27.10.2014

Have you even read what he said? he wanted money not skin.


Re: What i have wrong here - SKAzini - 27.10.2014

Start using zcmd and sscanf and do it like this:

pawn Code:
CMD:money(playerid, params[])
{
    new id, money;
    if(sscanf(params, "ui", id, money))
        return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /money [id] [amount]");
    GivePlayerMoney(id, money);
    return 1;
}



Re: What i have wrong here - dominik523 - 27.10.2014

Maybe he can read the tutorial and learn how to create a command using ZCMD and sscanf and use that knowledge to create any command, no matter changing player's skin or setting their money.


Re: What i have wrong here - Dezzzy - 27.10.2014

Quote:
Originally Posted by SKAzini
View Post
Start using zcmd and sscanf and do it like this:

pawn Code:
CMD:money(playerid, params[])
{
    new id, money;
    if(sscanf(params, "ui", id, money))
        return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /money [id] [amount]");
    GivePlayerMoney(id, money);
    return 1;
}
i did and got this error
HTML Code:
C:\Users\Gigi\Desktop\America Life\gamemodes\tutorial.pwn(103) : error 017: undefined symbol "sscanf"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.