stock bool: IsPlayerMuted( playerid) {
return ( ( ( gettime( ) < PlayerInfo[ playerid] [ pMuted] ) ? ( true ) : ( false ) ) ) ;
}
CMD: mute( playerid, params[ ] )
{
if ( ! IsPlayerAdmin( playerid) || PlayerInfo[ playerid] [ pAdmin] < 1 ) {
return SendClientMessage( playerid, COLOR_SERVER, "[BC:RP] {FFFFFF}Niste admin." ) ;
}
new
targetID,
muteTime,
muteReason[ 50 ] ,
playerName[ MAX_PLAYER_NAME] ,
targetName[ MAX_PLAYER_NAME] ,
buffer[ 144 ] ;
if ( sscanf ( params
, "ris[32]" , targetID
, muteTime
, muteReason
) ) { return SendClientMessage( playerid, COLOR_SERVER, "[Usage]: {FFFFFF}/mute [ID/Ime] [Vrijeme] [Razlog]" ) ;
}
#if !defined MAX_MUTE_TIME //why tho
#define MAX_MUTE_TIME 1000
#endif
#if !defined IS_IN_RANGE
#define IS_IN_RANGE(%0,%1,%2) (((%0)-((%1)+cellmin))<((%2)-((%1)+cellmin)))
#endif
if ( ! ( IS_IN_RANGE( muteTime, 0 , MAX_MUTE_TIME + 1 ) ) ) {
return SendClientMessage( playerid, COLOR_SERVER, "[Usage]: Vrijeme ne moze biti manje od 0 (skidanje mute-a) i vece od " #MAX_MUTE_TIME".");
}
if ( ! muteTime) {
PlayerInfo[ targetID] [ pMuted] = 0 ;
PlayerInfo[ targetID] [ pMutedReason] [ 0 ] = '\0 ' ;
SendClientMessage( playerid, - 1 , "Admin vam je skinuo mute." ) ;
return 1 ;
}
GetPlayerName( playerid, playerName, sizeof ( nameBuffer) ) ;
format( buffer, sizeof ( buffer) , "Utisani ste od strane admina {FFFFFF}%s {FF0000} na {FFFFFF}%d {FF0000}minuta. Razlog: {FFFFFF}%s." , playerName, muteTime, muteReason) ;
SendClientMessage( targetID, 0xFF0000FF , buffer) ;
GetPlayerName( targetID, targetName, sizeof ( targetName) ) ;
format( buffer, sizeof ( buffer) , "[Mute]: Admin {FFFFFF}%s {FF0000}je utisao igraca {FFFFFF}%s {FF0000}na {FFFFFF}%d {FF0000}minuta. Razlog: {FFFFFF}%s" , playerName, targetName, muteTime, muteReason) ;
foreach( Player, i) {
if ( PlayerInfo[ i] [ pStaff] ) {
SendClientMessage( i, 0xFF0000FF , buffer) ;
}
}
#if !defined strcpy
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
#endif
// gettime() > returns UNIX time.
// 60 * time > converts time to minutes
PlayerInfo[ targetID] [ pMuted] = gettime( ) + ( 60 * targetTime) ;
strcpy ( PlayerInfo
[ targetID
] [ pMutedReason
] , muteReason
) ;
return 1 ;
}
c3RvY2sgYm9vbDpJc1BsYXllck11dGVkKHBsYXllcmlkKSB7CiAgICByZXR1cm4gKCgoZ2V0dGltZSgpIDwgUGxheWVySW5mb1twbGF5ZXJpZF1bcE11dGVkXSkgPyAodHJ1ZSkgOiAoZmFsc2UpKSk7Cn0KQ01EOm11dGUocGxheWVyaWQsIHBhcmFtc1tdKQp7CiAgICBpZiAoIUlzUGxheWVyQWRtaW4ocGxheWVyaWQpIHx8IFBsYXllckluZm9bcGxheWVyaWRdW3BBZG1pbl0gPCAxKSB7CiAgICAgICAgcmV0dXJuIFNlbmRDbGllbnRNZXNzYWdlKHBsYXllcmlkLCBDT0xPUl9TRVJWRVIsICJbQkM6UlBdIHtGRkZGRkZ9TmlzdGUgYWRtaW4uIik7CiAgICB9CgogICAgbmV3CiAgICAgICAgdGFyZ2V0SUQsCiAgICAgICAgbXV0ZVRpbWUsCiAgICAgICAgbXV0ZVJlYXNvbls1MF0sCiAgICAgICAgcGxheWVyTmFtZVtNQVhfUExBWUVSX05BTUVdLAogICAgICAgIHRhcmdldE5hbWVbTUFYX1BMQVlFUl9OQU1FXSwKICAgICAgICBidWZmZXJbMTQ0XTsKCiAgICBpZiAoc3NjYW5mKHBhcmFtcywgInJpc1szMl0iLCB0YXJnZXRJRCwgbXV0ZVRpbWUsIG11dGVSZWFzb24pKSB7CiAgICAgICAgcmV0dXJuIFNlbmRDbGllbnRNZX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kgKyAoNjAgKiB0YXJnZXRUaW1lKTsKICAgIHN0cmNweShQbGF5ZXJJbmZvW3RhcmdldElEXVtwTXV0ZWRSZWFzb25dLCBtdXRlUmVhc29uKTsKCiAgICByZXR1cm4gMTsKfQ==
compilation info
prog.c:1:1: error: unknown type name ‘stock’
stock bool:IsPlayerMuted(playerid) {
^~~~~
prog.c:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
stock bool:IsPlayerMuted(playerid) {
^
prog.c:4:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
CMD:mute(playerid, params[])
^
prog.c:27:29: error: "%" may not appear in macro parameter list
#define IS_IN_RANGE(%0,%1,%2) (((%0)-((%1)+cellmin))<((%2)-((%1)+cellmin)))
^
prog.c:31:129: error: stray ‘#’ in program
return SendClientMessage(playerid, COLOR_SERVER, "[Usage]: Vrijeme ne moze biti manje od 0 (skidanje mute-a) i vece od "#MAX_MUTE_TIME".");
^
prog.c:54:20: error: "%" may not appear in macro parameter list
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
^
stdout