give gun command (Help)
#1

(Help) how to make command give gun but without id 38
Reply
#2

PHP код:
CMD:deserteagle(playerid,params[])
{
     
GivePlayerWeapon(playerid24);
     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.
Reply
#3

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(playeridparams[]){
    new 
pidwidammostr[128], pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000"ERROR: You can't use this command");
    if(
sscanf(params"uii"pidwidammo)) return SendClientMessage(playerid, -1"USAGE: /givegun [player id] [weapon id] [ammo]");
    if(!
IsPlayerConnected(pid)) return SendClientMessage(playerid0xFF0000"ERROR: Player is not cnnected");
    if(
wid == 38) return SendClientMessage(playerid0xFF0000"ERROR: weapond id 38 is forbidden");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(pidtNamesizeof(tName));
    
GivePlayerWeapon(pidwidammo);
    
format(strsizeof(str), "Administrator %s has given %s %w with %d ammo",pNametNamewidammo);
    
SendClientMessageToAll(0xFF00FFstr);
    return 
1;

Reply
#4

you right ryderx but my callback not work?

i dont no how to fix that

and eoussama how do you get formatex
Reply
#5

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

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

Download formatex, and put it in your include folder
pawno\include
Reply
#8

can you give me the formatex.inc

i dont no how to compile it
Reply
#9

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
This requires ZCMD , sscanf2 and formatex
why formatex ?
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)