12.08.2015, 18:33
Soo... I need simple cmd so player can ask admins help about the server /asq and a cmd /respond so admins can answer the players question. Tnx in advance who helps (not for a RP server)
Soo... I need simple cmd so player can ask admins help about the server /asq and a cmd /respond so admins can answer the players question. Tnx in advance who helps (not for a RP server)
|
#define MAX_ADMIN_MESSAGES (0) // How many messages there can be in queue?
enum _aMessages {
mStatus, // is active?
mFrom, // Who is the sender?
mTime, // When it was sent?
mCont[128] // Message itself
// and You can carry on and add as much details as You want.
// for example purposes, we'll stick with those.
} new questionsForAdmins[ MAX_ADMIN_MESSAGES ][ _aMessages ];
public OnGameModeInit() {
// begin of the block
for( new MessageId = 0; MessageId < MAX_ADMIN_MESSAGES; MessageId++ ) {
questionsForAdmins[ MessageId ][ mFrom ] = INVALID_PLAYER_ID;
questionsForAdmins[ MessageId ][ mTime ] = 0;
questionsForAdmins[ MessageId ][ mStatus ] = 0;
format( questionForAdmins[ MessageId ][ mCont ], 128, "\0");
}
// rest of the code
}
stock NewQuestion( IssuerId, const Message[] ) {
if( IssuerId > MAX_PLAYERS || !IsPlayerConnected(IssuerId))
return false;
new MessageId = 0;
while( questionForAdmins[ MessageId ][ mStatus ] > 0 ) // Find first free 'slot'
MessageId ++;
questionsForAdmins[ MessageId ][ mTime ] = gettime();
questionsForAdmins[ MessageId ][ mFrom ] = IssuerId;
questionsForAdmins[ MessageId ][ mStatus ] = 1;
format( questionForAdmins[ MessageId ][ mCont ], 128, "%s", Message );
new _str[128];
format( _str, 128, " * New message from id %d!", IssuerId ); // Notification for all RCON admins
for( new PlayerId = 0; PlayerId < MAX_PLAYERS; PlayerId++ )
if( IsPlayerAdmin( PlayerId ) )
SendClientMessage( PlayerId, -1, _str );
return true;
}