ocmd:sup(playerid,params[])
{
if(isAdmin(playerid,1))
{
if(SupAccept[playerid] != -1)
{
if(!params[0])return SendClientMessage(playerid,C_Error,"Info: /sup [Text]");
new string[145];
format(string, sizeof(string), "%s[Sup] %s", getPlayerName(playerid),params);
new pID = SupAccept[playerid];
SendClientMessage(pID, 0xFF0000FF, string);
SendClientMessage(playerid, 0xFF0000FF, string);
}
else
{
SendClientMessage(playerid,C_Error,"Du hast keinen offenen Supportchat!");
}
}
if(strlen(SupportText[playerid]) >= 5)
{
if(SupAccept[playerid] != -1)
{
if(!params[0])return SendClientMessage(playerid,C_Error,"Info: /sup [Text]");
new string[145];
format(string, sizeof(string), "%s[Sup] %s", getPlayerName(playerid),params);
new pID = SupAccept[playerid];
SendClientMessage(pID, 0xFF0000FF, string);
SendClientMessage(playerid, 0xFF0000FF, string);
}
else
{
SendClientMessage(playerid,C_Error,"Du hast keinen offenen Supportchat!");
}
}
else
{
ShowPlayerDialog(playerid,Support_Dialog,DIALOG_STYLE_INPUT,"[Report System]","Bitte gebe dein Report in das untere Feld.","Absenden","Abbrechen");
}
return 1;
}
ocmd:showreports(playerid,params[])
{
if(!isAdmin(playerid,1))return SendClientMessage(playerid,C_Error,noaccess);
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerNPC(i))continue;
format(string, sizeof(string), "%s%s | %s\n", string, SupportName[i], SupportText[i]);
}
ShowPlayerDialog(playerid, ShowReportDialog, DIALOG_STYLE_LIST, "Aktuelle Reports", string, "Annehmen", "Abbrechen");
return 1;
}
ocmd:delsup(playerid,params[])
{
if(!isAdmin(playerid,1))return SendClientMessage(playerid,-1,noaccess);
new pID;
if (sscanf(params, "u", pID)) {
return SendClientMessage(playerid, C_Weiß, "Info: /delsupport [playerid/name]");
}
if (!IsPlayerConnected(pID)) {
return SendClientMessage(playerid, COLOR_RED, "Spieler ist Offline.");
}
if (SupAccept[playerid] == -1 || SupAccept[pID] == -1) {
return SendClientMessage(playerid, COLOR_RED, "Du oder der Spieler ist nicht im Support!");
}
SendClientMessage(playerid,-1,"Du hast den Report geschlossen!");
SendClientMessage(pID,-1,"Dein Report wurde geschlossen!");
SupAccept[playerid] = -1;
SupAccept[pID] = -1;
format(SupportText[pID], sizeof(SupportText[]), " ");
return 1;
}
if(dialogid==Support_Dialog)
{
if(response)
{
if(strlen(inputtext)>8)
{
format(SupportName[playerid],MAX_PLAYER_NAME, getPlayerName(playerid));
format(SupportText[playerid],128,inputtext);
SendClientMessage(playerid,C_Blau,"Dein Report wurde erfolgreich gespeichert.");
SendClientMessage(playerid,C_Blau,"Ein Adminisitrator wird sich gleich um dein Report kümmern.");
}
else
{
SendClientMessage(playerid,C_Error,"Dein Report ist zu kurz!");
ShowPlayerDialog(playerid,Support_Dialog,DIALOG_STYLE_INPUT,"[Report System]","Bitte gebe dein Report in das untere Feld.","Absenden","Abbrechen");
}
}
}
if(dialogid==ShowReportDialog)
{
new pID = ReturnPlayerID(SupportName[pID]);
if(!response)return 1;
if(!strlen(SupportName[pID]))return 1;
SendClientMessage(pID, 0xFF0000FF, "Dein Report wurde geöffnet. Du kannst jetzt mit /sup schreiben.");
SupAccept[pID]=playerid;
SupAccept[playerid]=pID;
return 1;
}
stock ReturnPlayerID(l_PlayerName[])//©Jeffry
{
new l_name[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, l_name, MAX_PLAYER_NAME);
if(!strcmp(l_name,l_PlayerName, true)) return i;
}
}
return INVALID_PLAYER_ID;
}
Alles anzeigen