Questions -
Kyance - 01.01.2014
Well, I'm planning to create a command like "givegun" (Not admin command, but a player command).
Eh, since i haven't started, i will give some questions(Most of them will probably sound dumb, lol.)
#1 - Could "GivePlayerWeapon(id, GetPlayerWeapon(playerid), amount)" work?
The command should make it so the player gives the target the weapon he is holding.
#2 - How can you detect if the player doesn't have so much ammunition? GetPlayerWeaponData stuff, or..?
Well.. that's about it, hope that you could answer/explain it to me :]
Re: Questions -
Stereotype - 01.01.2014
#1 .. ofc, to detect other player use
tmp = strtok(cmdtext, idx);
otherplayer = ReturnUser(tmp);
#2 .. yup ..
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Re: Questions -
Kyance - 01.01.2014
Quote:
Originally Posted by Stereotype
|
Alright, uh, could you give me an example of the #2 please?;d
Re: Questions -
Stereotype - 01.01.2014
here is my cmd that check player weapons
pawn Код:
CMD:getweapons(playerid, params[])
{
new message[128], Player, weapon, ammo;
if(pInfo[playerid][AdminLevel] < 2) return admMsg(playerid);
if(sscanf(params, "u", Player)) return SCM(playerid, 0xC4C4C4FF, "Usage: /getweapons <playerid>");
for(new i=0;i<13;i++)
{
GetPlayerWeaponData(Player, i, weapon, ammo);
if(weapon != 0)
{
format(message, sizeof(message), "Player %s's weapons: Slot(%d): Weapon ID(%d) Ammo(%d)", GetName(Player),i, weapon, ammo);
SendClientMessage(playerid, -1, message);
return 1;
}
}
return 1;
}
Re: Questions -
Kyance - 01.01.2014
Quote:
Originally Posted by Stereotype
here is my cmd that check player weapons
pawn Код:
CMD:getweapons(playerid, params[]) { new message[128], Player, weapon, ammo; if(pInfo[playerid][AdminLevel] < 2) return admMsg(playerid); if(sscanf(params, "u", Player)) return SCM(playerid, 0xC4C4C4FF, "Usage: /getweapons <playerid>"); for(new i=0;i<13;i++) { GetPlayerWeaponData(Player, i, weapon, ammo); if(weapon != 0) { format(message, sizeof(message), "Player %s's weapons: Slot(%d): Weapon ID(%d) Ammo(%d)", GetName(Player),i, weapon, ammo); SendClientMessage(playerid, -1, message); return 1; } } return 1; }
|
Hm, alright, thanks for the quick answers!
+rep