#include <a_samp>
#include "../include/gl_common.inc"
#define ADMINFS_MESSAGE_COLOR 0xFF444499
#define PM_INCOMING_COLOR 0xFFFF22AA
#define PM_OUTGOING_COLOR 0xFFCC2299
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
cmd = strtok(cmdtext, idx);
public OnFilterScriptInit()
{
print("Rcon befehle");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(pm,2,cmdtext);
dcmd(ban,3,cmdtext);
dcmd(kick,4,cmdtext);
return 1;
}
dcmd_pm(playerid,params[])
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5)
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Benutze: /pm (id) (message)");
return 1;
}
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage))
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Benutze: /pm (id) (message)");
return 1;
}
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Spieler ID");
return 1;
}
if(playerid != id)
{
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,PM_INCOMING_COLOR,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
}
else
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Du kannst dir nicht selbst eine pn schrieben.");
}
return 1;
}
}
dcmd_kick(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5)
{
return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Benutze: /kick (id) [reason]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Böse spieler ID");
return 1;
}
gMessage = strrest(cmdtext,idx);
GetPlayerName(id,iName,sizeof(iName));
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- Du hast ihn vom server gekickt.");
if(strlen(gMessage) > 0)
{
format(Message,sizeof(Message),"Reason: %s",gMessage);
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
}
format(Message,sizeof(Message),">> %s(%d) hast ihn gekickt.",iName,id);
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
Kick(id);
return 1;
}
else
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Du bist kein admin");
return 1;
}
}
}
dcmd_ban(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5)
{
return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Benutze: /ban (id) [reason]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Böse spieler ID");
return 1;
}
gMessage = strrest(cmdtext,idx);
GetPlayerName(id,iName,sizeof(iName));
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- Du hast ihn vom server gebannt.");
if(strlen(gMessage) > 0)
{
format(Message,sizeof(Message),"Reason: %s",gMessage);
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
}
format(Message,sizeof(Message),">> %s(%d) hat ihn gebannt.",iName,id);
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
Ban(id);
return 1;
}
else
{
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Du bist kein admin");
return 1;
}
}
Das ist jetzt erstmal als filterscript, kommt aber in den basis script rein, aber erst wenn es geht.
Das sind meine errors:
C:\rcon dcmd.pwn(18) : error 010: invalid function or declaration
C:\rcon dcmd.pwn(37) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(44) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(70) : warning 217: loose indentation
C:\rcon dcmd.pwn(35) : warning 203: symbol is never used: "params"
C:\rcon dcmd.pwn(35 -- 72) : error 054: unmatched closing brace ("}")
C:\rcon dcmd.pwn(78) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(89) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(74) : warning 203: symbol is never used: "params"
C:\rcon dcmd.pwn(74 -- 108) : error 054: unmatched closing brace ("}")
C:\rcon dcmd.pwn(114) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(125) : error 017: undefined symbol "cmdtext"
C:\rcon dcmd.pwn(110) : warning 203: symbol is never used: "params"
C:\rcon dcmd.pwn(110 -- 144) : warning 203: symbol is never used: "cmd"
C:\rcon dcmd.pwn(110 -- 144) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
9 Errors.
Alles anzeigen
Wo liegt hier der fehler ?
//edit: oder könnte mir das sogar jemand richtig korigieren ?