Hallo.
Ich habe ein Problem mit den Befehlen und zwar immer wenn ich / eingebe kommt das was bei OnPlayerCommandText oben steht als befehl:
public OnPlayerCommandText(playerid, cmdtext[]){ new string[256];// new playermoney; new sendername[MAX_PLAYER_NAME]; new giveplayer[MAX_PLAYER_NAME];// new playername[MAX_PLAYER_NAME]; new cmd[256]; new tmp[256]; new giveplayerid, idx; /*if(strcmp(cmd, "/restart", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 3) { GameTextForPlayer(playerid, "~r~ Server Neustart", 5000, 1); GameModeExit(); } else { SendClientMessage(playerid, COLOR_GRAD1, " Das darfst du nicht tun !"); } } return 1; }*/ /*if(strcmp(cmd, "/getip", true) == 0) { if (PlayerInfo[playerid][pAdmin] >= 2) {// new tmp[256]; tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GRAD1,"FEHLER: /getip [playerid]"); return 1; } giveplayerid = ReturnUser(tmp); new playersip[16]; GetPlayerIp(giveplayerid,playersip,sizeof(playersip)); format(string,sizeof(string),"IP: %s",playersip); SendClientMessage(playerid,COLOR_GRAD2,string); } return 1; }*/ if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0) { if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "BENUTZUNG: (/a)dmin [admin chat]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 1) { format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sFendername, result); SendAdminMessage(COLOR_LIGHTBLUE, string); } else { if(PlayerInfo[playerid][pMuted] == 1) { SendClientMessage(playerid, TEAM_CYAN_COLOR, " Du kannst nicht sprechen, du wurdest gemutet !"); return 1; } format(string, sizeof(string), "*Zivilist %s: %s", sendername, result); SendAdminMessage(COLOR_LIGHTBLUE, string); SendClientMessage(playerid, COLOR_LIGHTBLUE, " Deine Nachricht wurde an die Admins gesendet."); } printf("Zivilist %s: %s", sendername, result); //Log("OA-Chat.txt",string); } return 1; } if(strcmp(cmd, "/mute", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "FEHLER: /mute [playerid]"); return 1; } new playa; playa = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); if(PlayerInfo[playa][pMuted] == 0) { PlayerInfo[playa][pMuted] = 1; printf("AdmCmd: %s silenced %s",sendername, giveplayer); format(string, sizeof(string), "AdmCmd: %s wurde von %s zum Schweigen gebracht",giveplayer ,sendername); ABroadCast(COLOR_LIGHTRED,string,1); } else { PlayerInfo[playa][pMuted] = 0; printf("AdmCmd: %s unsilenced %s",sendername, giveplayer); format(string, sizeof(string), "AdmCmd: %s wurde von %s zum Reden gebracht",giveplayer ,sendername); ABroadCast(COLOR_LIGHTRED,string,1); } } } } else { SendClientMessage(playerid, COLOR_GRAD1, " Du darfst diesen Befehl nicht benutzen!"); } } return 1; } if(strcmp(cmd, "/makeadmin", true) == 0) { if(PlayerInfo[playerid][pAdmin] < 1337) { SendClientMessage(playerid,COLOR_GRAD2," Das Vergeben und Entziehen von Adminrechten ist nur den Admins erlaubt!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /makeadmin [ID] [Level]"); return 1; } new para1 = ReturnUser(tmp); tmp = strtok(cmdtext, idx); new level = strval(tmp); if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); if(PlayerInfo[para1][pAdmin] < level) { printf("AdmCmd: %s hat %s zu einem Level %d Admin befördert.", sendername, giveplayer, level); format(string, sizeof(string), " Du wurdest durch %s zu einem Level %d Admin befördert", sendername, level); SendClientMessage(para1, COLOR_LIGHTBLUE, string); format(string, sizeof(string), " Du hast %s zu einem Level %d Admin befördert.", giveplayer,level); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } else { printf("AdmCmd: %s hat %s zu einem Level %d Admin degradiert.", sendername, giveplayer, level); format(string, sizeof(string), " Du wurdest durch %s zu einem Level %d Admin degradiert", sendername, level); SendClientMessage(para1, COLOR_LIGHTBLUE, string); format(string, sizeof(string), " Du hast %s zu einem Level %d Admin degradiert.", giveplayer,level); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } PlayerInfo[para1][pAdmin] = level; } } else { SendClientMessage(playerid, COLOR_GRAD1, " Du bist nicht befugt diesen Befehl zu nutzen! "); } return 1; }
etc
if(strcmp(cmd, "/setplayerint", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "FEHLER: /setplayerint [playerid] [interiorid]"); return 1; } new playa; playa = ReturnUser(tmp); new intid; tmp = strtok(cmdtext, idx); intid = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); SetPlayerInterior(playa, intid); PlayerInfo[playa][pInt] = intid; format(string, sizeof(string), " Du hast %s den interior auf %d gesetzt.", giveplayer, intid); SendClientMessage(playerid, COLOR_GRAD1, string); format(string, sizeof(string), " %s hat deinen Interior auf %d gesetzt.", sendername, intid); SendClientMessage(playa, COLOR_GRAD1, string); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command!"); } } return 1; } return 1;}