ZitatIch glaub das er nichtmal das sscanf plugin nutzt
Doch, tu ich. Es funktioniert trotzdem nicht. Ich sehe mal alleine zu und versuchs zu lösen..
ZitatIch glaub das er nichtmal das sscanf plugin nutzt
Doch, tu ich. Es funktioniert trotzdem nicht. Ich sehe mal alleine zu und versuchs zu lösen..
Alles anzeigendcmd_pm(playerid,params[])
{
new PMplayer1,string[128];
if(sscanf(params,"us[128]",PMplayer1,string)) return SendClientMessage(playerid, COLOR_WHITE, "** Usage: /pm (PlayerID) (Text)");
if(PMplayer1 == playerid) return SendClientMessage(playerid, COLOR_MAUVE, "* You can not send yourself a PM.");
if(!(IsPlayerConnected(PMplayer1) && PMplayer1 != INVALID_PLAYER_ID)) return SendClientMessage(playerid, red, "** Invalid Player.");
GetPlayerName(PMplayer1, PmReceiver, sizeof(PmReceiver));
format(string,sizeof(string),"* PM to %s (ID: %d): %s ", PmReceiver, PMplayer1, string); // Was kommt denn hier rein um den Text zu sehen?
SendClientMessage(playerid,grey,string);
return 1;
}
Funktioniert nicht. sobald ich /pm ID text eingebe, erscheint mir die Usage nachricht..
habe aber das new PMplayer1 weg gelassen, weil es schon definiert war und nur warnings brachte
dcmd_pm(playerid,params[])
{
if(!strlen(params)) return
SendClientMessage(playerid, COLOR_WHITE, "** Usage: /pm (PlayerID)");
PMplayer1 = strval(params);
if(PMplayer1 == playerid) return
SendClientMessage(playerid, COLOR_MAUVE, "* You can not send yourself a PM.");
if(!(IsPlayerConnected(PMplayer1) && PMplayer1 != INVALID_PLAYER_ID)) return
SendClientMessage(playerid, red, "** Invalid Player.");
new string[128];
GetPlayerName(PMplayer1, PmReceiver, sizeof(PmReceiver));
format(string,sizeof(string),"* PM to %s (ID: %d): %s ", PmReceiver, PMplayer1, ?????); // Was kommt denn hier rein um den Text zu sehen?
SendClientMessage(playerid,grey,string);
return 1;
}
Was kommt beim "????" rein um den Text zu sehen?
Ich liebe dich, Danke!
Ich kann als Level 8 aber Spieler auf Level 9 oder 10 promoten wenn sie unter level 8 sind.
Ich möchte aber, dass ich als Level 8 nur bis Level 8 promoten kann, sowie als 9 nur bis Level 9, als 10 bis 10.
dcmd_setlevel(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 8 || IsPlayerAdmin(playerid))
{
new tmp [256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params))
{
new string[128];
format(string,sizeof(string),"** Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
SendClientMessage(playerid,COLOR_WHITE,string);
return SendClientMessage(playerid, COLOR_WHITE, "** This command is for higher Admin Levels only. You are not allowed to play with the /setlevel command. ");
}
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return
SendClientMessage(playerid, COLOR_WHITE, "** Usage: /setlevel [PlayerID] [Level (0-10)]") &&
SendClientMessage(playerid, COLOR_WHITE, "** This command is for higher Admin Levels only. You are not allowed to play with the /setlevel command. ");
level = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(AccInfo[player1][LoggedIn] == 1)
{
if(level > AccInfo[playerid][Level])
{
format(string,sizeof(string), "You can't use /setlevel on %s as your Admin Level is the same or lower.", pName(player1));
return SendClientMessage(playerid, yellow, string);
}
if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!");
format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
MessageToAdmins(yellow, string);
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day;
new hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);
if(level > 5)
{
AdmRank = "Professional Admin";
}
switch(level)
{
case 1: AdmRank = "Admin Level 2";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Administrator";
case 5: AdmRank = "Master Administrator";
}
if(level > 0)
format(string,sizeof(string),"* Administrator %s has granted Admin Level %d to you.",adminname, level);
else
format(string,sizeof(string),"* Administrator %s has granted Player Status to you. You are Level %d now.",adminname, level);
SendClientMessage(player1,yellow,string);
if(level > AccInfo[player1][Level])
GameTextForPlayer(player1,"~g~Congratulations!", 4000, 3);
else GameTextForPlayer(player1,"~r~Demotion", 4000, 3);
format(string,sizeof(string),"* Administrator %s has granted permanent Admin Level %s to %d.",adminname, level, playername);
SaveIn("AdminLog",string);
dUserSetINT(PlayerName2(player1)).("Level",(level));
AccInfo[player1][Level] = level;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
}
else return SendClientMessage(playerid,red,"** This player is not logged in or is not registred.");
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid,red,"** You need to login before using commands.");
}
Admins mit niedrigem Level sollten keinen höheren Admin promoten oder demoten können. Man sollte auch nicht selber sein Level setzen können.
Der code sollte eigentlich genau das tun, es funktioniert aber nicht. Ich kann immernoch höhere Admins zb lvl 10er mit lvl 8 demoten.
Es funktioniert dennoch nicht.
Niedrige admin levels können immernoch höhere promoten bzw demoten..
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(AccInfo[player1][LoggedIn] == 1)
{
if(level > AccInfo[playerid][Level])
{
format(string,sizeof(string), "You can't use /setlevel on %s .", pName(player1));
return SendClientMessage(playerid, yellow, string);
}
if(level > ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"** Admin has already this Level!"); // [(2452) : warning 217: loose indentation]
format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
MessageToAdmins(yellow, string);
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day;
new hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);
Es ist doch alles richtig, wieso bekomme ich nen Error?
dcmd_setlevel(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
new tmp [256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params))
{
new string[128];
format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
SendClientMessage(playerid,LIGHTBLUE2,string);
return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
}
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
level = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(AccInfo[player1][LoggedIn] == 1)
{
if(level > ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"** Admin has already this Level!");
format(string,sizeof(string),"* Admin %s has granted premanent Administrator Level %d to %s.", pName(playerid), level, pName(player1));
MessageToAdmins(yellow, string);
if(level > AccInfo[playerid][Level]) return format(string,sizeof(string), "You can't use /setlevel on %s .", pName(playerid));
SendClientMessage(playerid, yellow, string);
Funktioniert nicht
Ich bekomms iwie net hin, bekomme ständig errors^^
Ich kann mich auch selbst promoten, kann wer helfen?
dcmd_setlevel(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
new tmp [256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params))
{
new string[128];
format(string,sizeof(string),"Usage: /setlevel [PlayerID] [Level (0-%d)]", ServerInfo[MaxAdminLevel]);
SendClientMessage(playerid,LIGHTBLUE2,string);
return SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
}
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setlevel [PlayerID] [Level (0/5)]") &&
SendClientMessage(playerid, orange, "Function: Will set the Level of Administration of the Specific Player");
level = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(AccInfo[player1][LoggedIn] == 1)
{
if(level > ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"ERROR: Invalid Level");
if(level == AccInfo[player1][Level])
return SendClientMessage(playerid,red,"ERROR: Player is already this level");
SendCommandToAdmins(playerid,"SetLevel");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day;
new hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);
if(level > 5)
{
AdmRank = "Professional Admin";
}
switch(level)
{
case 1: AdmRank = "Admin Level 2";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Administrator";
case 5: AdmRank = "Master Administrator";
}
if(level > 0)
format(string,sizeof(string),"|- Administrator %s has set you to Administrator Status | Level: %d - %s -|",adminname, level, AdmRank);
else
format(string,sizeof(string),"|- Administrator %s has set you to Player Status | Level: %d -|",adminname, level);
SendClientMessage(player1,LIGHTBLUE,string);
if(level > AccInfo[player1][Level])
GameTextForPlayer(player1,"Promoted", 2000, 3);
else GameTextForPlayer(player1,"Demoted", 2000, 3);
format(string,sizeof(string),"You have given %s Level %d on '%d/%d/%d' at '%d:%d:%d'", playername, level, day, month, year, hour, minute, second);
SendClientMessage(playerid,yellow,string);
format(string,sizeof(string),"Administrator %s has made %s Level %d",adminname, playername, level);
SaveIn("AdminLog",string);
dUserSetINT(PlayerName2(player1)).("Level",(level));
AccInfo[player1][Level] = level;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
}
else return SendClientMessage(playerid,red,"ERROR: This player is not Registred or Logged!");
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Wie verbiete ich niedrigeren Admin Levels höhere Admin Levels zu promoten?
Wie kann ich denn eine Message an alle Admins senden, dass ich mich zu dem bestimmten Player teleportiert habe?
Zum Beispiel Admin X has teleported to Player Y
dcmd_goto(playerid,params[])
{
if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
{
if(!strlen(params)) return
SendClientMessage(playerid, COLOR_WHITE, "** Usage: /goto [PlayerID]") &&
SendClientMessage(playerid, COLOR_WHITE, "** Allows to teleport to a player.");
new player1;
new string[128];
if(!IsNumeric(params))
player1 = ReturnPlayerID(params);
else player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
{
new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
SetPlayerInterior(playerid,GetPlayerInterior(player1));
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
}
else SetPlayerPos(playerid,x+2,y,z);
format(string,sizeof(string),"* You have teleported to %s.", pName(player1));
return SendClientMessage(playerid,BlueMsg,string);
}
else return ErrorMessages(playerid, 4);
}
else return ErrorMessages(playerid, 1);
}
Habe das als forward:
forward MessageToAdmins(color,const string[]);
public OnPlayerSpawn(playerid)
//das eine
{
StopAudioStreamForPlayer(playerid);
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
return 1;
}
//das andere
{
if(IsPlayerNPC(playerid))
{
new npcname[64];
GetPlayerName(playerid,npcname,64);
if(!strcmp(npcname,"[Bot]Name",true))
{
//SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
SetSpawnInfo(playerid, 0, 107, 2492.5146, -1703.2296, 1015.5703, 328.5485, 0, 0, 0, 0, 0, 0);
new Text3D:NameEintragen = Create3DTextLabel("Dieb",0xFFFFFFAA,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(NameEintragen, playerid, 0.0, 0.0, 0.5);
SetPlayerColor(playerid,0x00FF00AA);
return 1;
}
}
return 0;
}
Ich habe zwei Sachen die ich unter OnPlayerSpawn unterbringen möchte, bekomme es aber nicht hin. Was muss ich beachten, was mache ich falsch? Lol
Hier ist nun etwas Ruhe eingekehrt, wird denn noch weiterhin entwickelt?
Wurde es eigentlich schon im englischen Forum gepostet? Wäre doch mal super wenn pawno die natives auch so unterstützen würde
Ich habe nun die beiden Includes entfernt
#include <zcmd>
#include <sscanf2>
und es funktioniert wieder. Kann einer weiterhelfen? Darf ich zcmd und sscanf2 net zusammen verwenden oder wie?
Die Befehle die mit zcmd erstellt worden sind funktionieren jetzt jedoch nicht.
Habs nun komplett in ein neues Gamemode eingefügt und es funktioniert nun.
Danke für eure Antworten!
Soweit ich weiß ist es nicht möglich.
@Fuldera:
Du hast aber nicht wie von @bestermaxilp: 2x givecredits oder ?
Nein, hab alles korrigiert
Ich habe alles probiert was ihr geschrieben habt, es geht echt nix
Ich bin verzweifelt..
Hast du denn in der letzten Zeit ein Filterscript eingefügt? Manche Filterscripts blockieren die Befehle im Gamemode.
Nope, einfach am Script rumgebastelt.
Selbst mit ocmd habe ich den selben Fehler. Bekomme immer Unknown CMD..
Funktioniert nicht.
(426) : error 010: invalid function or declaration
Ist das zweite return 1.