Anti-Verrat System!

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
  • Hi alle!


    Ich hatte vor einigen Tagen die Idee, ein Anti-Verrat System zu machen! D.h.: Wenn Spieler X einmal ein Skin/Gang auswaehlt, kann er diese nicht mehr aendern und wird ab sofort fuer immer mit diesem spielen:


    SetPlayerSpawn(playerid) // You don't need to write public at the first, unless you are going to call this callback with a timer.
    {
    new p_skin = gPlayerSkinForEver[playerid]; // This is BALLAS.
    if(p_skin == 102 || p_skin == 103 || p_skin == 104) {
    new Float:x, Float:y, Float:z,angle;
    SetSpawnInfo(playerid, 1, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0);
    } // This is GROOVE.
    else if(p_skin == 267 || p_skin == 271 || p_skin == 270 || p_skin == 0 || p_skin == 105 || p_skin == 106 || p_skin == 107) { // You need to change these values.
    new Float:x,Float:y,Float:z,angle;
    SetSpawnInfo(playerid, 2, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0);
    } // This is VAGOS.
    else if(p_skin == 108 || p_skin == 109 || p_skin == 110) {
    new Float:x, Float:y, Float:z,angle; //
    SetSpawnInfo(playerid, 3, gPlayerSkinForEver[playerid], x, y, z, angle, 0, 0, 0, 0, 0, 0);
    }
    SpawnPlayer(playerid);
    return 1;
    }


    Das Dumme ist, das es nicht funktioniert!!!


    public OnPlayerRequestClass(playerid, classid) {
    if(gFirstTimeHasJoined[playerid]) return SetPlayerSpawn(playerid);
    PlayerPlaySound(playerid, 1068 , 0.0, 0.0, 0.0);
    switch(classid) {
    case 0..2: {
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    } case 3..9: {
    SetPlayerPos(playerid, 2486.7598,-1647.5186,14.0703);
    SetPlayerFacingAngle( playerid, 187.5500 );
    SetPlayerCameraPos(playerid, 2486.4346,-1646.0953-5,14.0703);
    SetPlayerCameraLookAt(playerid, 2486.7598,-1647.5186,14.0703);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
    } case 10..12: {
    SetPlayerPos(playerid, 2571.8352,-1091.2091,66.9639);
    SetPlayerFacingAngle(playerid, 48.7203 );
    SetPlayerCameraPos(playerid, 2570.1152,-1089.5372,66.8601);
    SetPlayerCameraLookAt(playerid, 2571.8352,-1091.2091,66.9639);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
    }
    }
    return 1;
    }


    Der Spieler kann beliebig oft seine Gang, Skin wahlen! Weiss einer, was da falsch ist???? :?: :?: :?:


    Meine Variablen:


    new gFirstTimeHasJoined[MAX_PLAYERS], gPlayerSkinForEver[MAX_PLAYERS];

  • Finde ich keine gute Idee.
    Kann der Leader denn den Spieler X kicken?


    Oder kann der Leader überhaupt selber aussteigen?
    Ich finds blöd, wenn der Spieler an eine Fraktion gebunden ist. ?(

  • Ein Beispiel von SAMP WIKI:
    public OnPlayerRequestClass(playerid,classid)
    {
    if(classid == 3 && !IsPlayerAdmin(playerid))
    { SendClientMessage(playerid,COLOR_GREEN,"This skin is only for admins!"); return 0; }
    return 1; }


    Ist doch logisch. Wenn der Spieler ein Admin ist , kann er die ClassID 3 nehmen.
    Wenn nicht, bekommt er eine Nachricht, dass der Skin nur für Admins ist.
    Also machst du jeden anderen Skin nur für bestimmt Personen.
    PS: Die Idee ist Schwachsinnig :D

  • Was verstehst du daran nicht, das Beispiel aus der Wiki:

    //
    if(classid == 3 && !IsPlayerAdmin(playerid))
    // Wenn classid gleich 3 und der spieler kein Admin ist
    {
    SendClientMessage(playerid,COLOR_GREEN,"This skin is only for admins!");
    return 0;
    }

    Dein Code:

    switch(classid) {
    case 0..2: {
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    }
    Wird so zu:

    if( (classid == 0 || classid == 1 || classid == 2) && (gPlayerSkinForEver[playerid] == 102 || gPlayerSkinForEver[playerid] == 103 || gPlayerSkinForEver[playerid] == 104))
    {
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    }
    else //*
    {
    //nachricht oder sowas
    return 0;
    }

    Wenn die classid 0,1,2 ist UND der Spieler hat den skin sowieso sowieso sowieso dann spawne ihn wenn nicht dann nicht.
    Du müsstest das else wohl noch in else if ändern und noch eine Abfrage reinbauen denn wenn er noch keinen skin hat soll er den ja behalten da müsste dann sowas rein wie
    else if(gPlayerSkinForEver[playerid] == 0) //*
    oder -1 oder was der Wert für "noch keinen" ist...

  • 4 Errors!


    Code
    D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(301) : error 014: invalid statement; not in switch
    D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(301) : warning 215: expression has no effect
    D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(301) : error 001: expected token: ";", but found ".."
    D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(301) : error 029: invalid expression, assumed zero
    D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(301) : fatal error 107: too many error messages on one line
    
    
    Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase




    public OnPlayerRequestClass(playerid, classid) {
    if(gFirstTimeHasJoined[playerid]) return SetPlayerSpawn(playerid);
    PlayerPlaySound(playerid, 1068 , 0.0, 0.0, 0.0);
    if( (classid == 0 || classid == 1 || classid == 2) && (gPlayerSkinForEver[playerid] == 102 || gPlayerSkinForEver[playerid] == 103 || gPlayerSkinForEver[playerid] == 104))


    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    } case 3..9: {
    SetPlayerPos(playerid, 2486.7598,-1647.5186,14.0703);
    SetPlayerFacingAngle( playerid, 187.5500 );
    SetPlayerCameraPos(playerid, 2486.4346,-1646.0953-5,14.0703);
    SetPlayerCameraLookAt(playerid, 2486.7598,-1647.5186,14.0703);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
    } case 10..12: {
    SetPlayerPos(playerid, 2571.8352,-1091.2091,66.9639);
    SetPlayerFacingAngle(playerid, 48.7203 );
    SetPlayerCameraPos(playerid, 2570.1152,-1089.5372,66.8601);
    SetPlayerCameraLookAt(playerid, 2571.8352,-1091.2091,66.9639);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
    }
    }
    return 1;
    }

  • LOL, hab' vergessen zu posten, dass ich es schon lange gefixt habe^^ sry...


    public OnPlayerRequestClass(playerid, classid)
    {
    if(gFirstTimeHasJoined[playerid]) return SetPlayerSpawn(playerid);
    PlayerPlaySound(playerid, 1068 , 0.0, 0.0, 0.0);
    if( (classid == 0 || classid == 1 || classid == 2) && (gPlayerSkinForEver[playerid] == 102 || gPlayerSkinForEver[playerid] == 103 || gPlayerSkinForEver[playerid] == 104))
    {
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    }
    else if( (classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 || classid == 8 || classid == 9) && (gPlayerSkinForEver[playerid] == 269 || gPlayerSkinForEver[playerid] == 271 || gPlayerSkinForEver[playerid] == 270 || gPlayerSkinForEver[playerid] == 0 || gPlayerSkinForEver[playerid] == 105 || gPlayerSkinForEver[playerid] == 106 || gPlayerSkinForEver[playerid] == 107))
    { SetPlayerPos(playerid, 2486.7598,-1647.5186,14.0703);
    SetPlayerFacingAngle( playerid, 187.5500 );
    SetPlayerCameraPos(playerid, 2486.4346,-1646.0953-5,14.0703);
    SetPlayerCameraLookAt(playerid, 2486.7598,-1647.5186,14.0703);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
    }
    else if( (classid == 10 || classid == 11 || classid == 12) && (gPlayerSkinForEver[playerid] == 108 || gPlayerSkinForEver[playerid] == 109 || gPlayerSkinForEver[playerid] == 110))
    { SetPlayerPos(playerid, 2571.8352,-1091.2091,66.9639);
    SetPlayerFacingAngle(playerid, 48.7203 );
    SetPlayerCameraPos(playerid, 2570.1152,-1089.5372,66.8601);
    SetPlayerCameraLookAt(playerid, 2571.8352,-1091.2091,66.9639);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
    }


    return 0;
    }


    Stimmts?

  • Tripple Post, na das wird gern gesehen :)


    Unter jede Abfrage ein return 0;


    Also bei dem hier unten drunter:


    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    return 0;


    Und bei den anderen genau so.

  • Sry, bitte nicht verwarnen^^


    Ist das jetzt alles ok hier???


    public OnPlayerRequestClass(playerid, classid)
    {
    if(gFirstTimeHasJoined[playerid]) return SetPlayerSpawn(playerid);
    PlayerPlaySound(playerid, 1068 , 0.0, 0.0, 0.0);
    if( (classid == 0 || classid == 1 || classid == 2) && (gPlayerSkinForEver[playerid] == 102 || gPlayerSkinForEver[playerid] == 103 || gPlayerSkinForEver[playerid] == 104))
    {
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 1992.1263,-1175.7640,20.1479);
    SetPlayerFacingAngle( playerid, 187.0574 );
    SetPlayerCameraPos(playerid, 1991.3074,-1179.9628,20.0234);
    SetPlayerCameraLookAt(playerid, 1992.1263,-1175.7640,20.1479);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
    return 0;
    }


    else if( (classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 || classid == 8 || classid == 9) && (gPlayerSkinForEver[playerid] == 269 || gPlayerSkinForEver[playerid] == 271 || gPlayerSkinForEver[playerid] == 270 || gPlayerSkinForEver[playerid] == 0 || gPlayerSkinForEver[playerid] == 105 || gPlayerSkinForEver[playerid] == 106 || gPlayerSkinForEver[playerid] == 107))
    { SetPlayerPos(playerid, 2486.7598,-1647.5186,14.0703);
    SetPlayerFacingAngle( playerid, 187.5500 );
    SetPlayerCameraPos(playerid, 2486.4346,-1646.0953-5,14.0703);
    SetPlayerCameraLookAt(playerid, 2486.7598,-1647.5186,14.0703);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
    return 0;
    }

    else if( (classid == 10 || classid == 11 || classid == 12) && (gPlayerSkinForEver[playerid] == 108 || gPlayerSkinForEver[playerid] == 109 || gPlayerSkinForEver[playerid] == 110))
    { SetPlayerPos(playerid, 2571.8352,-1091.2091,66.9639);
    SetPlayerFacingAngle(playerid, 48.7203 );
    SetPlayerCameraPos(playerid, 2570.1152,-1089.5372,66.8601);
    SetPlayerCameraLookAt(playerid, 2571.8352,-1091.2091,66.9639);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
    return 0;
    }


    return 0;
    }


    Die Klammern werden hier komisch angezeigt, so verschoben, sry!

  • Nein, brauchst für jede Abfrage mit classid ein eigenes else mit return 0 sonst kann man ja trotzdem spawnen


    Was zur HOELLE HAST DU GALABERT! JETZT SEH ICH GAR KEINEN SPIELER MEHR WENN ICH EINEN AUSWEAHLEN WILL! WARUM LABERN, WENN MAN NICHTS WEISS! MEINE GAMEMODE IST JETZT ABGEFUUUUUUUCKT! IDIOT! ICH KANN NICHT MAL MEHR SPAWNEN!