Errors in setalaram Command
#1

Can you fix it anoyone ? Got errors ...
Ty who can ...

Sry for bother you again...

The errors in any last lines at each commands... Ty

Код:
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84503) : warning 213: tag mismatch
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84756) : warning 213: tag mismatch
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84756) : error 032: array index out of bounds (variable "HouseInfo")
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84761) : error 017: undefined symbol "giveplayerid"
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84766) : error 017: undefined symbol "strvalEx"
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84767) : warning 213: tag mismatch
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84767) : error 032: array index out of bounds (variable "HouseInfo")
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84768) : error 017: undefined symbol "string"
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84768) : error 017: undefined symbol "string"
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84768) : error 029: invalid expression, assumed zero
d:\Users\User\Desktop\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP.pwn(84768) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Код:
CMD:setalarm(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new housekey = PlayerInfo[playerid][pPhousekey];
	        if(housekey == 0)
	    	{
				SendClientMessage(playerid, COLOR_GREY, "   You don't own a House!");
			    return 1;
			}
			if(HouseInfo[housekey][pSafe] == 0)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Your House does not have an Alarm System!");
				return 1;
			}
            if(sscanf(params, "u", giveplayerid))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setalarm [phone number]");
				return 1;
			}
			new number = strvalEx(tmp);
			HouseInfo[housekey][pPnumber] = number;
			format(string, sizeof(string), "* Alarm System has been configured to send notifications to phone number %d.", number);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			SaveHouse(housekey);
	    }
	    return 1;
	}
CMD:houseupgrade(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
            if(sscanf(params, "u", giveplayerid))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /houseupgrade [name]");
				SendClientMessage(playerid, COLOR_GREY, "Available names: Alarm, Gunlocker");
				SendClientMessage(playerid, COLOR_GREY, "Alarm = $100,000");
				SendClientMessage(playerid, COLOR_GREY, "GunLocker = $50,000");
				return 1;
			}
			if(strcmp(tmp,"alarm",true) == 0)
			{
			    if(PlayerInfo[playerid][pPhousekey] >= 1)
			    {
			        new id = PlayerInfo[playerid][pPhousekey];
			    	if(PlayerInfo[playerid][pCash] < 100000)
					{
						SendClientMessage(playerid, COLOR_GREY, "   You don't have enough money!");
						return 1;
					}
			    	if(HouseInfo[id][pSafe] == 1)
			    	{
			        	SendClientMessage(playerid, COLOR_GREY, "   You already have an Alarm in your House!");
			        	return 1;
			    	}
			    	HouseInfo[id][pSafe] = 1;
			    	SendClientMessage(playerid, COLOR_YELLOW, "You have upgraded your House with an Alarm System for $100,000.");
			    	SendClientMessage(playerid, COLOR_WHITE, "Commands: /setalarm, /togalarm");
			    	PlayerInfo[playerid][pCash] -= 100000;
					GivePlayerMoney(playerid,-100000);
					SaveHouse(id);
			    	return 1;
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   You don't own a House!");
				    return 1;
				}
			}
   			if(strcmp(tmp,"gunlocker",true) == 0)
			{
			    if(PlayerInfo[playerid][pPhousekey] >= 1)
			    {
			        new id = PlayerInfo[playerid][pPhousekey];
			    	if(PlayerInfo[playerid][pCash] < 50000)
					{
						SendClientMessage(playerid, COLOR_GREY, "   You don't have enough money!");
						return 1;
					}
			    	if(HouseInfo[id][hGL] >= 5)
			    	{
			        	SendClientMessage(playerid, COLOR_GREY, "   Your Gunlocker is at its limit!");
			        	return 1;
			    	}
			    	HouseInfo[id][hGL]++;
			    	format(string, sizeof(string), "You have upgraded your Gunlocker for $50000, you now have %d slots available.", HouseInfo[id][hGL]);
			    	SendClientMessage(playerid, COLOR_YELLOW, string);
			    	PlayerInfo[playerid][pCash] -= 50000;
					GivePlayerMoney(playerid,-50000);
					SaveHouse(id);
			    	return 1;
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   You don't own a House!");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   Invalid upgrade name!");
				return 1;
			}
	    }
	    return 1;
	}
Reply
#2

you are checking your params in a wrong syntax!
pawn Код:
new giveplayerid;
if(sscanf(params, "u", giveplayerid) {
//code between brackets
}

// before formatting your string you need to index
new number = strvalEx(tmp), string[256];
HouseInfo[housekey][pPnumber] = number;
format(string, sizeof(string), "* Alarm System has been configured to send notifications to phone number %d", number);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
btw use [ pawn] and [ /pawn] without space next time to line out your code better, this must fix some of your errors, i watched globally, let's see what errors you have left and what code is on what line with what error
Reply
#3

These scripts make me laugh...

Код:
CMD:setalarm(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
Obviously the fucking player is connected if they're typing the command.
Reply
#4

lol indeed, i did not even read everything just quickly searched from some mistakes.


and indeed its a bit retarted to check if a player is connected but its usefull in situations when you are working with targets

Edit: also verry funny , in zcmd combined with sscanf

pawn Код:
if(strcmp(tmp,"alarm",true) == 0)
Reply
#5

Just think, it add three lines of code every time it's used in this manner and I'm sure there are a few hundred commands that could amount to a value of about one percent of the code which doesn't seem like a lot but it's a lot of inflation considering there is over 84,000 lines. That amount of lines would be an absolute nightmare to try and keep things organized and updated instead of using includes and taking a modular scripting approach opposed to a donkey approach.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)