block weap?
#1

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
Reply
#2

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

It's [pawn] not [pawno]
Reply
#4

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
Reply
#5

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

He had his code like this::

[pawno]some code[/pawno]

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


Forum Jump:


Users browsing this thread: 1 Guest(s)