give gun command (Help) -
crukk11 - 12.02.2017
(Help) how to make command give gun but without id 38



Re: give gun command (Help) -
RyderX - 12.02.2017
PHP код:
CMD:deserteagle(playerid,params[])
{
GivePlayerWeapon(playerid, 24);
return 1;
}
It's not necessary to include Minigun id to give all weapons, you can simply use
GivePlayerWeapon(playerid, weaponid);
Under a Command or a callback,
You can get Weapons IDs From here:
https://sampwiki.blast.hk/wiki/Weapons
For example, We want to get sawn-off shotgun, what should we do?
PHP код:
CMD:mycommand(playerid,params[])
{
//do something here
return 1;
}
ok Now we have to give player sawn off, Sawn-off id is 26, so we have to type like this:
PHP код:
CMD:sawnoff(playerid,params[])
{
GivePlayerWeapon(playerid,26);
return 1;
}
and same method as all weapons.
Re: give gun command (Help) -
Eoussama - 12.02.2017
This requires ZCMD , sscanf2 and formatex
ZCMD:
https://sampforum.blast.hk/showthread.php?tid=91354
formatex :
https://sampforum.blast.hk/showthread.php?tid=313488
sscanf2 :
https://sampforum.blast.hk/showthread.php?tid=570927
PHP код:
CMD:givegun(playerid, params[]){
new pid, wid, ammo, str[128], pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000, "ERROR: You can't use this command");
if(sscanf(params, "uii", pid, wid, ammo)) return SendClientMessage(playerid, -1, "USAGE: /givegun [player id] [weapon id] [ammo]");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFF0000, "ERROR: Player is not cnnected");
if(wid == 38) return SendClientMessage(playerid, 0xFF0000, "ERROR: weapond id 38 is forbidden");
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pid, tName, sizeof(tName));
GivePlayerWeapon(pid, wid, ammo);
format(str, sizeof(str), "Administrator %s has given %s %w with %d ammo",pName, tName, wid, ammo);
SendClientMessageToAll(0xFF00FF, str);
return 1;
}
Re: give gun command (Help) -
crukk11 - 12.02.2017
you right ryderx but my callback not work?
i dont no how to fix that
and eoussama how do you get formatex
Re: give gun command (Help) -
Eoussama - 12.02.2017
Quote:
Originally Posted by crukk11
you right ryderx but my callback not work?
i dont no how to fix that
and eoussama how do you get formatex
|
check the link I provided there, it has the download link and all instructions
Re: give gun command (Help) -
crukk11 - 12.02.2017
when i compile i got this error
C:\Users\Cyber\Desktop\New folder\gamemodes\GL.pwn(6) : fatal error 100: cannot read from file: "formatex"
Re: give gun command (Help) -
Eoussama - 12.02.2017
Download formatex, and put it in your include folder
pawno\include
Re: give gun command (Help) -
crukk11 - 12.02.2017
can you give me the formatex.inc
i dont no how to compile it
Re: give gun command (Help) -
TATIK - 12.02.2017
Quote:
Originally Posted by Eoussama
This requires ZCMD , sscanf2 and formatex
|
why formatex ?
Re: give gun command (Help) -
Eoussama - 12.02.2017
Quote:
Originally Posted by TATIK
why formatex ?
|
I'm too lazy to create a function that returns weapon names (depending on their ids)
so formatex saves time (%w)