#8

PHP код:
CMD:wplayeridparams[] ) {
    new 
weapidammo
        
userid;
    if( !
IsPlayerAdminplayerid ) )
        return 
SendClientMessage(playeridCOLOR_GRAY"You are not authorized to use that command!"); 
    if( 
sscanfparams"iiU(65535)"weapidammouserid ) ) 
        return 
SendClientMessageplayeridCOLOR_GRAY"Usage: /w [weapon id] [ammo] [optional playerid]" );
    if( 
weapid || weapid 46 )
        return 
SendClientMessage(playeridCOLOR_GRAY"Invalid weapon ID!"); 
    if( 
ammo <= )
        return 
SendClientMessage(playeridCOLOR_GRAY"Invalid ammo!"); 
    if( 
userid == INVALID_PLAYER_ID ) {
        
userid playerid;
    } else {
        if( !
IsPlayerConnecteduserid ) )
            return 
SendClientMessageplayeridCOLOR_GRAY"Player isn't connected." );
    }
    
GivePlayerWeaponuseridweapidammo );
    
SendClientMessageplayeridCOLOR_GRAY"Gun spawned!" );
    return 
1;

Read up on sscanf specifiers. A capital U means optional.
https://sampforum.blast.hk/showthread.php?tid=570927
Reply


Messages In This Thread
/w - by InSain - 23.02.2018, 05:42
Re: /w - by BulletRaja - 23.02.2018, 05:58
Re: /w - by RogueDrifter - 23.02.2018, 05:59
Re: /w - by BulletRaja - 23.02.2018, 07:13
Re: /w - by rfr - 23.02.2018, 07:58
Re: /w - by RogueDrifter - 23.02.2018, 08:00
Re: /w - by rfr - 23.02.2018, 08:02
Re: /w - by Kane - 23.02.2018, 08:10
Re: /w - by Stev - 23.02.2018, 08:16
Re: /w - by kingmk - 23.02.2018, 11:34

Forum Jump:


Users browsing this thread: 1 Guest(s)