Need Help with Command for buying packages
#1

Hello, I need a bit of help with my script I'm developing. Using ZCMD, and Sscanf (both includes are working, and such). The command is suppose to be something like /buypackage weapondrop and /buypackage airstrike and so on.
I've been unable to resolve this issue however; Thanks in advance for assistance.

Код:
CMD:buypackage(playerid, params[])
{
	new package;
	new amount;
    if(!sscanf(params, "su", package, amount))
    {
        if(package == "WeaponDrop")
        {
            new float:math;
			math = amount*10;
			if(score[playerid] >= math)
			{
			    score[playerid] = score[playerid] - math;
			    SendClientMessage(playerid, gold, "WeaponDrop Purchased."

			}
			else
			{
			    SendClientMessage(playerid, gold, "Not enough points for this package, or the number you request is out of reach");
			}
		}
	}
	return 1;
}
C:\Server\gamemodes\new.pwn(401) : error 033: array must be indexed (variable "-unknown-")
C:\Server\gamemodes\new.pwn(405) : error 028: invalid subscript (not an array or too many subscripts): "score"
C:\Server\gamemodes\new.pwn(405) : warning 215: expression has no effect
C:\Server\gamemodes\new.pwn(405) : error 001: expected token: ";", but found "]"
C:\Server\gamemodes\new.pwn(405) : error 029: invalid expression, assumed zero
C:\Server\gamemodes\new.pwn(405) : fatal error 107: too many error messages on one line
Reply
#2

Need this for starters, you missed the ");"

pawn Код:
SendClientMessage(playerid, gold, "WeaponDrop Purchased.");
Reply
#3

Aw :L solves one problem.

Still the 405 Error which is
Код:
if(score[playerid] >= math)
and line 401 error which is
Код:
if(package == "WeaponDrop")
Reply
#4

Try to remove the " ", might work then
Reply
#5

Redefine math as just a normal cell, rather than a float, unless the score variable is also a float.

Also, for the other error, do if(strcmp(package, "WeaponDrop", true) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)