/givegun (not admin cmd) - 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: /givegun (not admin cmd) (
/showthread.php?tid=131469)
/givegun (not admin cmd) -
Naruto4 - 03.03.2010
Код:
dcmd_givegun(playerid, params[])
{
new wep,player;
if(sscanf(params, "ud", player,wep)) return SCM(playerid, CMD, "Usage: /givegun [PlayerName/ID] [Weapon ID]");
if(wep == 38 || wep == 35 || wep == 36 || wep == 37 || wep == 9 || wep == 26 || wep == 39) return 1;
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
if(wep != weapons[i][0])
{
SCM(playerid,LIGHTRED,"You don't have that weapon.");
}
else
{
GivePlayerWeapon(player, wep, weapons[i][1]);
}
}
return 1;
}
I failed. I wanted to check for "wep" if he has it and give it to some player.
Result: spam + doesnt get a gun
Re: /givegun (not admin cmd) -
Naruto4 - 03.03.2010
bump
Re: /givegun (not admin cmd) -
Naruto4 - 03.03.2010
Bump please help. I dont know what to do anymore.
Re: /givegun (not admin cmd) -
RSC_Quicker - 03.03.2010
Nvm I got it wrong. Sorry
Re: /givegun (not admin cmd) -
Naruto4 - 04.03.2010
Quote:
Originally Posted by Seif_
Quote:
Originally Posted by Rules
b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 12 hours old.
|
You're not being clear enough.
|
I am not ??
-/givegun [ID] [Gun]
It is a rp command for players to give their guns to others. I am using GetPlayerWeaponDate to check if that player has the [Gun] he entered into the command.
Re: /givegun (not admin cmd) -
RSC_Quicker - 04.03.2010
Well, why you don't just use getplayerweapon?
So he have to scroll the weapon that he wants to give.
And u can use this:
Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
new plyWeapons[12];
new plyAmmo[12];
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != weaponid)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
ResetPlayerWeapons(playerid);
for(new slot = 0; slot != 12; slot++)
{
GivePlayerWeapon(playerid, plyWeapons[slot], MAX_AMMO);
}
}