setname

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • was hier falsch?


    dcmd_setname(playerid,params[])
    {
    if(PlayerData[playerid][Level] >= 3)
    {
    new opfer,name,string[128],oname[MAX_PLAYER_NAME];
    if(sscanf(params,"us",opfer,name)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /setname [playerid] [new name]");
    if (!IsPlayerConnected(opfer)) return SendClientMessage(playerid, COLOR_SYSTEM, "Invalid ID!");
    if(name < 3 || name > MAX_PLAYER_NAME) return SendClientMessage(playerid,COLOR_RED,"Invalid Name Length!");
    GetPlayerName(opfer,oname,sizeof(oname));
    SetPlayerName(opfer,name);
    format(string,sizeof(string),"[Server] %s will now be known as %s",oname,name);
    SendClientMessageToAll(COLOR_RED,string);
    return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"Admins only!");
    }


    argument type mismatch (argument 2)


    was stimmt an dem SetPlayerName(opfer,name); nicht?

  • Hab auch ein error Code:

    dcmd_setname(playerid,params[])
    {
    if(PlayerEQ[playerid][admlevel] < 10) return SendClientMessage(playerid, RED, "Du bist kein Admin!");
    new opfer,name[128],string[128],oname[MAX_PLAYER_NAME];
    if(sscanf(params,"us",opfer,name)) return SendClientMessage(playerid,RED,"USAGE: /setname [playerid] [new name]");
    if (!IsPlayerConnected(opfer)) return SendClientMessage(playerid,RED, "Invalid ID!");
    if(name < 3 || name > MAX_PLAYER_NAME) return SendClientMessage(playerid,RED,"Invalid Name Length!");
    GetPlayerName(opfer,oname,sizeof(oname));
    SetPlayerName(opfer,name);
    format(string,sizeof(string),"[Server] %s will now be known as %s",oname,name);
    SendClientMessageToAll(RED,string);
    return 1;
    }


    C:\Users\Steve\Desktop\freeroom\freeroom\gamemodes\test.pwn(770) : error 033: array must be indexed (variable "name")