Insurance problem.
#1

Hello, I'm trying to fix my setinsurance commands that you see the name of the insurance in stead of the number

Errors I get
Код:
Gamemode.pwn(16399) : warning 219: local variable "insur" shadows a variable at a preceding level
Gamemode.pwn(16400) : error 033: array must be indexed (variable "-unknown-")
Gamemode.pwn(16397) : warning 203: symbol is never used: "insur"
Gamemode.pwn(23799) : error 006: must be assigned to an array
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Command:

Код:
CMD:setinsurance(playerid, params[])
{
 	if (PlayerInfo[playerid][pAdmin] >= 4)
	{
		new string[128], giveplayerid, insurance;
		if(sscanf(params, "ud", giveplayerid, insurance))
		{
			SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setinsurance [player] [insurance]");
			SendClientMessageEx(playerid, COLOR_RED, "NOTE: This command will be saved in server logs. Make sure you give ONLY insurance 3!");
			SendClientMessageEx(playerid, COLOR_ORANGE, "Available Insurances: 1 = [CountyGen], 2 = [All Saints]");
			SendClientMessageEx(playerid, COLOR_ORANGE, "Available Insurances: 3 = [Montgomery], 4 = [Fort Carson], 5 = [San Fiero]");
			SendClientMessageEx(playerid, COLOR_ORANGE, "Available Insurances: 6 = [Gold Room], 7 = [At Home], 8 = [BlueBerry], 9 = [Tierra Robada] 10 = [LAAS Base]");
			return 1;
		}

  		if(insurance >= 0 && insurance <= 10)
		{
			format(string, sizeof(string), " Your insurance has been changed to %d.", GetInsuranceName(giveplayerid));
			SendClientMessageEx(giveplayerid,COLOR_LIGHTBLUE,string);
			format(string, sizeof(string), " You have changed %s's insurance to %d.", GetPlayerNameEx(giveplayerid), GetInsuranceName(giveplayerid));
			SendClientMessageEx(playerid,COLOR_LIGHTBLUE,string);
			format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has set %s's insurance to %d.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetInsuranceName(giveplayerid));
			ABroadCast(COLOR_YELLOW, string, 4);
			PlayerInfo[giveplayerid][pInsurance] = GetInsuranceName(giveplayerid);
			Log("logs/insurance.log", string);
			return 1;
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
	}
	return 1;
}
Forward:

Код:
stock GetInsuranceName(insur)
{
	new insur[20];
	switch(insur)
	{
		case 1: insur = "County General";
		case 2: insur = "All Saints";
		case 3: insur = "Montgomery";
		case 4: insur = "Fort Carson";
		case 5: insur = "San Fierro";
		case 6: insur = "Club VIP";
		case 7: insur = "Home Care";
		case 9: insur = "El Quebrados";
		case 10: insur = "SAAS Base Hospital";
		case 11: insur = "Las Venturas";
		case 12: insur = "Special Room";
		case 13: insur = "LAAS Base";
		case 14: insur = "Bayside";
		default: insur = "None";
	}
	return insur;
}


How can I fix this ?
Reply


Messages In This Thread
Insurance problem. - by IndependentGaming - 30.06.2016, 19:48
Re: Insurance problem. - by Runn3R - 30.06.2016, 20:08
Re: Insurance problem. - by IndependentGaming - 30.06.2016, 20:15
Re: Insurance problem. - by IndependentGaming - 30.06.2016, 20:41
Re: Insurance problem. - by Stinged - 30.06.2016, 20:49
Re: Insurance problem. - by IndependentGaming - 30.06.2016, 20:57
Re: Insurance problem. - by Stinged - 30.06.2016, 21:03
Re: Insurance problem. - by IndependentGaming - 30.06.2016, 21:13
Re: Insurance problem. - by Stinged - 30.06.2016, 21:17
Re: Insurance problem. - by IndependentGaming - 30.06.2016, 21:18

Forum Jump:


Users browsing this thread: 1 Guest(s)