SA-MP Forums Archive
block weap? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: block weap? (/showthread.php?tid=64502)



block weap? - My_Waffles_Bitch_L0L - 04.02.2009

Yh right, if i putted ths into my admin script, tah /w2 cmd to spawn weapons. Ehm, i ONLY wanna block 1 weapon. And that is minigun. I will make it to an admin weapon, af course blocked for non-admins, is that possilble? (/w2 code token from the Debug made by Simon)

Код:
dcmd_w2(playerid, params[])
{
	new idx, iString[128];
	iString = strtok(params, idx);

	if (!strlen(iString)) {
	  SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w2 [WEAPON ID/NAME] [AMMO] or /weapon [WEAPON ID/NAME] [AMMO]");
	  return true;
	}

	new weaponid = GetWeaponModelIDFromName(iString);

	if (weaponid == -1) {
		weaponid = strval(iString);
		if (weaponid < 0 || weaponid > 47) {
	  	SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEAPON ID/NAME.");
	  	return true;
		}
	}

	if (!strlen(params[idx+1])) {
	  GivePlayerWeapon(playerid, weaponid, 500);
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
	  format(iString, 128, "%s were given weapon %s (ID: %d) with 500 ammo.",pName, aWeaponNames[weaponid], weaponid);
	  SendClientMessageToAll(COLOR_PINK, iString);

	  return true;
	}

	idx = strval(params[idx+1]);

  GivePlayerWeapon(playerid, weaponid, idx);
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(iString, 128, "%s were given weapon %s (ID: %d) with %d ammo.",pName, aWeaponNames[weaponid], weaponid, idx);
  SendClientMessageToAll(COLOR_PINK, iString);

	return true;
}
:P


Re: block weap? - ICECOLDKILLAK8 - 04.02.2009

replace
Код:
if (weaponid == -1)
with
Код:
if (weaponid == -1 || weaponid == 38)
That way Minigun will show up as a invalid weapon


Re: block weap? - LarzI - 04.02.2009

It's [pawn] not [pawno]


Re: block weap? - My_Waffles_Bitch_L0L - 04.02.2009

Quote:
Originally Posted by JeNkStAX
replace
Код:
if (weaponid == -1)
with
Код:
if (weaponid == -1 || weaponid == 38)
That way Minigun will show up as a invalid weapon
ty :P


Re: block weap? - ICECOLDKILLAK8 - 04.02.2009

Quote:
Originally Posted by <3 HardStyle <3 | LarzI
It's [pawn] not [pawno]
lolwut?


Re: block weap? - LarzI - 04.02.2009

He had his code like this::

[pawno]some code[/pawno]

But it's actually [pawn]some code[ /pawn]