Problem mit Abfrage ob Spieler Online ist

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
  • Das ist mein Spawn

    public OnPlayerSpawn(playerid)
    {
    PlayerTextDrawDestroy(playerid,BALKEN1);
    PlayerTextDrawDestroy(playerid,BALKEN2);
    PlayerTextDrawDestroy(playerid,LOSSANTOS);
    PlayerTextDrawDestroy(playerid,REALLIFE);
    StopAudioStreamForPlayer(playerid);
    SetPlayerSkin(playerid,GetPVarInt(playerid,"Skin"));
    if(GetPVarInt(playerid,"TOT") > 0)
    {
    SetPlayerPos(playerid,1550.9017,-1827.8055,-24.3494);
    TogglePlayerControllable(playerid,false);
    SetPlayerCameraPos(playerid,1458.9214,-1710.5381,82.5252);
    SetPlayerCameraLookAt(playerid,1498.7738,-1812.9108,67.5367);
    PlayerTextDrawShow(playerid,KHCOUNT);



    }
    else if(GetPVarInt(playerid,"KNAST") > 0)
    {
    SetPlayerPos(playerid,1563.2574,-1660.4712,11.6375);
    PlayerTextDrawShow(playerid,KHCOUNT);
    }
    else
    switch(GetPVarInt(playerid,"Fraktion"))
    {
    case 0: {SetPlayerPos(playerid,NOOBSPAWN); SetPlayerVirtualWorld(playerid,NOOBWORLD); SetPlayerInterior(playerid,NOOBINT);SetPlayerColor(playerid,0xFFFFFFFF);}
    case 1: {SetPlayerPos(playerid,SANISPAWN); SetPlayerVirtualWorld(playerid,SANIWORLD); SetPlayerInterior(playerid,SANIINT);SetPlayerColor(playerid,0xFF0000FF);}
    case 2: {SetPlayerPos(playerid,LSPDSPAWN); SetPlayerVirtualWorld(playerid,LSPDWORLD); SetPlayerInterior(playerid,LSPDINT);SetPlayerColor(playerid,0x009DFFFF);}
    case 3: {SetPlayerPos(playerid,FBISPAWN); SetPlayerVirtualWorld(playerid,FBIWORLD); SetPlayerInterior(playerid,FBIINT);SetPlayerColor(playerid,0x0000FFFF);}
    }



    if(GetPVarInt(playerid,"WANTED") > 0)
    {
    new count_string[28];
    format(count_string,sizeof(count_string),"Wanted %d",GetPVarInt(playerid,"WANTED"));
    PlayerTextDrawSetString(playerid,WACOUNT, count_string);
    PlayerTextDrawShow(playerid,WACOUNT);
    }



    if(GetPVarInt(playerid,"Ban") >= 1 )
    {
    SendClientMessage(playerid,INFO,"Dein Account ist Gebannt");
    Kick(playerid);
    return 1;
    }
    return 1;
    }

    Und Das mein SpawnInfo
    SetSpawnInfo(playerid,-1,GetPVarInt(playerid,"Skin"),x,y,z,0,0,0,0,0,0,0);

    Einmal editiert, zuletzt von _Flex_ ()

  • es ist bei allen befehlen wo ich eine Playerid angeben muss ich frage die Playerids mit sscanf2 ab und dann mit u


    Das ist jetzt mal ein beispiel befehl



    ocmd:wa(playerid,params[])
    {
    new Grund[28],Anzahl,pID;
    new string[128],count_string[28];
    new NAME[MAX_PLAYER_NAME];
    if(sscanf(params,"uis",pID,Anzahl,Grund)) return SendClientMessage(playerid,INFO,"Benutze: /wa [{FFFFFF}Playerid {008080}| {FFFFFF}Namen{008080}] [{FFFFFF}Anzahl{008080}] [{FFFFFF}Grund{008080}]");
    {
    if(GetPVarInt(playerid,"Fraktion") == 2 || GetPVarInt(playerid,"Fraktion") == 3)
    {
    if(IsPlayerConnected(pID))
    {
    new NAMEBAN = GetPlayerName(playerid,NAME,24);
    format(string,sizeof(string),"Du hast von{FFFFFF}%s {008080}%d Wanteds bekommen Grund: {FFFFFF}%s{FFFFFF}!",NAMEBAN,Anzahl,Grund);
    SendClientMessage(pID,INFO,string);
    new NAMEBANVON = GetPlayerName(playerid,NAME,24);
    format(string,sizeof(string),"Du hast {FFFFFF}%s {008080}%d Wanteds gegebent Grund: {FFFFFF}%s{008080}!",NAMEBANVON,Anzahl,Grund);
    SendClientMessage(playerid,INFO,string);
    PlayerTextDrawShow(pID,WACOUNT);
    SetPVarInt(pID,"WANTED",GetPVarInt(pID,"WANTED")+Anzahl);
    format(count_string,sizeof(count_string),"Wanted %d",GetPVarInt(pID,"WANTED"));
    PlayerTextDrawSetString(pID,WACOUNT, count_string);
    if(GetPVarInt(pID,"Wanted") <= 0)
    {



    PlayerTextDrawHide(pID,WACOUNT);
    SetPVarInt(pID,"WANTED",0);
    }
    return 1;
    }
    else SendClientMessage(playerid,INFO,"Diser Spieler ist nicht Online!");



    }
    else SendClientMessage(playerid,INFO,"Du bist kein Mitglied einer Staatsfraktion");
    }
    return 1;
    }

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Dann scheint da das sscanf Plugin irgendwas nicht richtig mitzubekommen. Grund sind eventuell andere Script/Plugins oder ein Fehler an einer ganz anderen Stelle.
    Versuche es mal hiermit:


    if(sscanf(params,"uis",pID,Anzahl,Grund)) return SendClientMessage(playerid,INFO,"Benutze: /wa [{FFFFFF}Playerid {008080}| {FFFFFF}Namen{008080}] [{FFFFFF}Anzahl{008080}] [{FFFFFF}Grund{008080}]");
    zu:
    new pidstr[32];
    pID = INVALID_PLAYER_ID;
    if(sscanf(params,"s[32]is[28]",pidstr,Anzahl,Grund)) return SendClientMessage(playerid,INFO,"Benutze: /wa [{FFFFFF}Playerid {008080}| {FFFFFF}Namen{008080}] [{FFFFFF}Anzahl{008080}] [{FFFFFF}Grund{008080}]");
    if(IsNumeric(pidstr)) if(IsPlayerConnected(strval(pidstr))) pID = strval(pidstr);
    if(pID == INVALID_PLAYER_ID) pID = ReturnPlayerID(pidstr);


    Zusammen mit diesen beiden Funktionen ganz unten im Gamemode:
    stock ReturnPlayerID(l_PlayerName[]) //©Jeffry
    {
    new l_name[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(GetPlayerName(i, l_name, MAX_PLAYER_NAME))
    {
    if(!strcmp(l_name,l_PlayerName, true)) return i;
    }
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(GetPlayerName(i, l_name, MAX_PLAYER_NAME))
    {
    if(strfind(l_name,l_PlayerName,true)!=-1) return i;
    }
    }
    return INVALID_PLAYER_ID;
    }


    stock IsNumeric(string[])
    {
    for(new i = 0, j = strlen(string); i < j; i++)
    {
    if(string[i] < '0' || string[i] > '9') return 0;
    }
    return 1;
    }