/spawnweapon trouble
#1

Heres my spawnweapon code

Код:
	if (strcmp(cmd, "/spawnweapon", true) == 0)
	{
		new gunid[16];
		new infostring[256];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			format(string, sizeof(string), "USAGE: /spawnweapon [upgradename] (You Have %d Upgrade points)",PlayerInfo[playerid][gPupgrade]);
			SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
			SendClientMessage(playerid, COLOR_WHITE,"*** UPGRADES ***");
			SendClientMessage(playerid, COLOR_GRAD2,string);
			if(PlayerInfo[playerid][pLevel] == 2)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 2 Weapons: sdpistol colt45");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 3)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 3 Weapons: sdpistol colt45 mp5");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 4)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 4 Weapons: sdpistol colt45 mp5 shotgun");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 5)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 5 Weapons: sdpistol colt45 mp5 shotgun spas12");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 6)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 6 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 7)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 7 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 8)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 8 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 9)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 9 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 10)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 10 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47 m4");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 11)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 11 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47 m4 rifle");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo rifleammo");
			}
			else if(PlayerInfo[playerid][pLevel] == 12)
			{
				SendClientMessage(playerid, COLOR_GRAD3, "Level 12 Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47 m4 rifle flamethrower");
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo rifleammo heavyammo");
			}
			else if(PlayerInfo[playerid][pLevel] >= 13)
			{
				format(infostring, 256, "Level %d Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47 m4 rifle ",PlayerInfo[playerid][pLevel]);
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo rifleammo heavyammo");
				SendClientMessage(playerid, COLOR_GRAD3, infostring);
			}
			SendClientMessage(playerid, COLOR_GRAD5, "Extra Health: health");
			SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
			}
			else if(PlayerInfo[playerid][pLevel] >= 15)
			{
				format(infostring, 256, "Level %d Weapons: sdpistol colt45 mp5 shotgun spas12 deagle uzi sawnoff tec9 ak47 m4 rifle Katana Chainsaw Sniper ",PlayerInfo[playerid][pLevel]);
				SendClientMessage(playerid, COLOR_GRAD4, "Extra Ammo: pistolammo shotgunammo smgammo assaultammo rifleammo heavyammo");
				SendClientMessage(playerid, COLOR_GRAD3, infostring);
			}
			SendClientMessage(playerid, COLOR_GRAD5, "Extra Health: health");
			SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
			return 1;
		strmid(gunid, tmp, 0, strlen(cmdtext), 255);
		if (PlayerInfo[playerid][gPupgrade] > 0)
		{
		
				else if (PlayerInfo[playerid][pLevel] >= 70 && (strcmp(gunid, "minigun", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A minigun");
				PlayerInfo[playerid][pGun5] = 38;
			}
				else if (PlayerInfo[playerid][pLevel] >= 5 && (strcmp(gunid, "parachute", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A parachute");
				PlayerInfo[playerid][pGun5] = 46;
			}
			else if (PlayerInfo[playerid][pLevel] >= 11 && (strcmp(gunid, "rifle", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A rifle");
				PlayerInfo[playerid][pGun5] = 33;
			}
			else if (PlayerInfo[playerid][pLevel] >= 15 && (strcmp(gunid, "sniper", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A sniper rifle");
				PlayerInfo[playerid][pGun5] = 34;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "m4", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With An m4");
				PlayerInfo[playerid][pGun4] = 31;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "golfclub", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A golfclub");
				PlayerInfo[playerid][pGun6] = 2;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "nightstick", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A nightstick");
				PlayerInfo[playerid][pGun6] = 3;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "knife", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A knife");
				PlayerInfo[playerid][pGun6] = 4;
			}
			else if (PlayerInfo[playerid][pLevel] >= 15 && (strcmp(gunid, "katana", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A katana");
				PlayerInfo[playerid][pGun6] = 8;
			}
							else if (PlayerInfo[playerid][pLevel] >= 15 && (strcmp(gunid, "chainsaw", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A chainsaw");
				PlayerInfo[playerid][pGun6] = 9;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "baseballbat", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A baseballbat");
				PlayerInfo[playerid][pGun6] = 5;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "shovel", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A shovel");
				PlayerInfo[playerid][pGun6] = 6;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "poolcue", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A poolcue");
				PlayerInfo[playerid][pGun6] = 7;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "purpledildo", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A purpledildo");
				PlayerInfo[playerid][pGun6] = 10;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "whitedildo", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A whitedildo");
				PlayerInfo[playerid][pGun6] = 11;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "longwhitedildo", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A longwhitedildo");
				PlayerInfo[playerid][pGun6] = 12;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "whitedildo2", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A whitedildo2");
				PlayerInfo[playerid][pGun6] = 13;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "flowers", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With flowers");
				PlayerInfo[playerid][pGun6] = 14;
			}
			else if (PlayerInfo[playerid][pLevel] >= 10 && (strcmp(gunid, "cane", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A cane");
				PlayerInfo[playerid][pGun6] = 15;
			}
			else if (PlayerInfo[playerid][pLevel] >= 9 && (strcmp(gunid, "ak47", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With An ak47");
				PlayerInfo[playerid][pGun4] = 30;
			}
			else if (PlayerInfo[playerid][pLevel] >= 9 && (strcmp(gunid, "Tec9", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A Tec9");
				PlayerInfo[playerid][pGun3] = 32;
			}
			else if (PlayerInfo[playerid][pLevel] >= 8 && (strcmp(gunid, "sawnoff", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A sawnoff");
				PlayerInfo[playerid][pGun2] = 26;
			}
			else if (PlayerInfo[playerid][pLevel] >= 7 && (strcmp(gunid, "uzi", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "SNew Upgrade: You Will Now Spawn With An uzi");
				PlayerInfo[playerid][pGun3] = 28;
			}
			else if (PlayerInfo[playerid][pLevel] >= 6 && (strcmp(gunid, "deagle", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A deagle");
				PlayerInfo[playerid][pGun1] = 24;
			}
			else if (PlayerInfo[playerid][pLevel] >= 5 && (strcmp(gunid, "spas12", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A spas12");
				PlayerInfo[playerid][pGun2] = 27;
			}
			else if (PlayerInfo[playerid][pLevel] >= 4 && (strcmp(gunid, "shotgun", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A shotgun");
				PlayerInfo[playerid][pGun2] = 25;
			}
			else if (PlayerInfo[playerid][pLevel] >= 3 && (strcmp(gunid, "mp5", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With An mp5");
				PlayerInfo[playerid][pGun3] = 29;
			}
			else if (PlayerInfo[playerid][pLevel] >= 2 && (strcmp(gunid, "colt45", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With A colt45");
				PlayerInfo[playerid][pGun1] = 22;
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "sdpistol", true, strlen(gunid)) == 0))
			{
				SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: You Will Now Spawn With An sdpistol");
				PlayerInfo[playerid][pGun1] = 23;
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "pistolammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo1] = PlayerInfo[playerid][pAmmo1]+50;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d Pistol Ammo (+50)",PlayerInfo[playerid][pAmmo1]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "shotgunammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo2] = PlayerInfo[playerid][pAmmo2]+50;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d Shotgun Ammo (+50)",PlayerInfo[playerid][pAmmo2]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "smgammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo3] = PlayerInfo[playerid][pAmmo3]+100;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d SMG Ammo (+100)",PlayerInfo[playerid][pAmmo3]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "assaultammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo4] = PlayerInfo[playerid][pAmmo4]+50;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d Assault Ammo (+50)",PlayerInfo[playerid][pAmmo4]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "rifleammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo5] = PlayerInfo[playerid][pAmmo5]+10;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d Rifleammo Ammo (+10)",PlayerInfo[playerid][pAmmo5]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "heavyammo", true, strlen(gunid)) == 0))
			{
				PlayerInfo[playerid][pAmmo6] = PlayerInfo[playerid][pAmmo6]+10;
				format(infostring, 256, "New Upgrade: You Will Now Spawn With %d Heavyammo Ammo (+50)",PlayerInfo[playerid][pAmmo6]);
				SendClientMessage(playerid, COLOR_GRAD6, infostring);
			}
			else if (PlayerInfo[playerid][pLevel] >= 1 && (strcmp(gunid, "health", true, strlen(gunid)) == 0))
			{
				if (PlayerInfo[playerid][pSHealth] < 100)
				{
					PlayerInfo[playerid][pSHealth] = PlayerInfo[playerid][pSHealth]+5.0;
					format(infostring, 256, "New Upgrade: You Will Now Spawn With %.2f Health (+5)",PlayerInfo[playerid][pSHealth]+50);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD6, "  You Have Maximum Spawn Health");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD6, "  Unrecognized Upgrade");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD6, "  You Have 0 Upgrade Points");
			return 1;
		}
		SetPlayerWeapons(playerid);
		PlayerInfo[playerid][gPupgrade]--;
		return 1;
	}
And my /spawnweapon errors

Код:
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10324) : warning 225: unreachable code
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10328) : error 029: invalid expression, assumed zero
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10328) : warning 215: expression has no effect
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10328) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

umm.. whitch lines are these?
Reply
#3


10324
Код:
strmid(gunid, tmp, 0, strlen(cmdtext), 255);
10328
Код:
		else if (PlayerInfo[playerid][pLevel] >= 70 && (strcmp(gunid, "minigun", true, strlen(gunid)) == 0))
Reply
#4

Quote:
Originally Posted by DeathGod
10324
Код:
strmid(gunid, tmp, 0, strlen(cmdtext), 255);
10328
Код:
		else if (PlayerInfo[playerid][pLevel] >= 70 && (strcmp(gunid, "minigun", true, strlen(gunid)) == 0))
else if (strcmp(gunid, "minigun", true, strlen(gunid)) == 0 && PlayerInfo[playerid][pLevel] >= 70) // tested and compiles perfectly

there is nothing wrong with 10324 because thats the same as it is in my script lol

Reply
#5

Now i get these errors
Код:
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10318) : warning 225: unreachable code
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10319) : error 029: invalid expression, assumed zero
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10321) : error 029: invalid expression, assumed zero
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10321) : warning 215: expression has no effect
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10321) : error 001: expected token: ";", but found "if"
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10521) : error 029: invalid expression, assumed zero
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(10526) : warning 225: unreachable code
D:\Dean's Documents\Freeroam\freeoam\Freeroamv132.pwn(19206) : warning 204: symbol is assigned a value that is never used: "plname"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
10319
Код:
	f (PlayerInfo[playerid][gPupgrade] > 0);
10321
Код:
	else if (strcmp(gunid, "minigun", true, strlen(gunid)) == 0 && PlayerInfo[playerid][pLevel] >= 70)
Код:
	else if (strcmp(gunid, "minigun", true, strlen(gunid)) == 0 && PlayerInfo[playerid][pLevel] >= 70)
Reply
#6

Quote:
Originally Posted by DeathGod
Код:
	else if (strcmp(gunid, "minigun", true, strlen(gunid)) == 0 && PlayerInfo[playerid][pLevel] >= 70)
Your ending the if clause before the &&, Remove the second ) after gunid
Reply
#7

Quote:
Originally Posted by JeNkStAX
Quote:
Originally Posted by DeathGod
Код:
	else if (strcmp(gunid, "minigun", true, strlen(gunid)) == 0 && PlayerInfo[playerid][pLevel] >= 70)
Your ending the if clause before the &&, Remove the second ) after gunid
forgot about that one :P but how could it be an error cause it compiles perfectly for me
Reply
#8

Actually my bad, You arnt ending the if statement, Its because you are using
pawn Код:
f (PlayerInfo[playerid][gPupgrade] > 0);
You dont need to add a ; to an if statement
pawn Код:
f (PlayerInfo[playerid][gPupgrade] > 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)