23.02.2018, 08:10
PHP код:
CMD:w( playerid, params[] ) {
new weapid, ammo,
userid;
if( !IsPlayerAdmin( playerid ) )
return SendClientMessage(playerid, COLOR_GRAY, "You are not authorized to use that command!");
if( sscanf( params, "iiU(65535)", weapid, ammo, userid ) )
return SendClientMessage( playerid, COLOR_GRAY, "Usage: /w [weapon id] [ammo] [optional playerid]" );
if( weapid < 0 || weapid > 46 )
return SendClientMessage(playerid, COLOR_GRAY, "Invalid weapon ID!");
if( ammo <= 0 )
return SendClientMessage(playerid, COLOR_GRAY, "Invalid ammo!");
if( userid == INVALID_PLAYER_ID ) {
userid = playerid;
} else {
if( !IsPlayerConnected( userid ) )
return SendClientMessage( playerid, COLOR_GRAY, "Player isn't connected." );
}
GivePlayerWeapon( userid, weapid, ammo );
SendClientMessage( playerid, COLOR_GRAY, "Gun spawned!" );
return 1;
}
https://sampforum.blast.hk/showthread.php?tid=570927