/invite befehl

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
  • ocmd:invite(playerid, params[])
    {
    new pID;
    if(sscanf(params, "u", pID))return SendClientMessage(playerid, 0xFFFFFFFF, "Benutzung: /invite (playerid)");
    if(PlayerInfo[playerid][pLeader] != 0)//Anpassen!
    {
    if(PlayerInfo[pID][pMember] == 0)
    {
    PlayerInfo[pID][pMember] = PlayerInfo[playerid][pLeader];
    }
    }
    return 1;
    }


    EDIT: Pawn Code

    Liebe Grüße


    Marcel


  • Da sind ein paar Bugs drinnnen, z.B. du kannst dich selber inviten, du kannst Leader als Member inviten :D


    Schreibe es so:


    //Aus meinem Tutorial
    ocmd:invite(playerid, params[])
    {
    new pID;
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,rot,"Verwendung: /invite [spielerid]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,rot,"Dieser Spieler ist nicht online !");
    if(pID == playerid) return SendClientMessage(playerid,rot,"Du kannst dich nicht selber inviten !");
    if(SpielerInfo[playerid][sLeader] == 0) return SendClientMessage(playerid,rot,"Du bist kein Leader !");
    if(SpielerInfo[pID][sMember] > 0 || SpielerInfo[pID][sLeader] > 0) return SendClientMessage(playerid,rot,"Dieser Spieler ist bereits in einer Fraktion !");
    new str[128], name[24], pname[24];
    GetPlayerName(pID, name, 24);
    GetPlayerName(playerid, pname, 24);
    format(str, 128,"Du wurdest von %s in die Fraktion invitet !",pname);
    SendClientMessage(pID,blau,str);
    format(str, 128,"Du hast %s in deine Fraktion invitet !!",name);
    SendClientMessage(playerid,blau,str);
    SpielerInfo[pID][sMember] = SpielerInfo[playerid][sLeader];
    SpielerInfo[pID][sRang] = 1;
    return 1;
    }


    mfg. :thumbup:

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

  • so mein eigener befehl sieht gerade so aus Kaliber wenn du den umändern kannst wäre es sehr nett:)


    ocmd:invite(playerid,params[])
    {
    new pID,fID;
    if(!isPlayerLeader(playerid,fID))return SendClientMessage(playerid,ROT,"Du bist kein Leader einer Fraktion!");
    if(sscanf(params,"u",pID))return SendClientMessage(playerid,BLAU,"/invite [playerid]");
    SetPVarInt(pID,"Fraktion",fID);
    SetPVarInt(pID,"Member",fID);
    SetPVarInt(pID,"Rang",1);
    SendClientMessage(playerid,BLAU,"Erfolgreich.");
    return 1;
    }

  • if(strcmp(cmd, "/invite", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /invite [playerid/Name]"); return 1; } new leader = PlayerInfo[playerid][pLeader]; new para1 = ReturnUser(tmp); if (PlayerInfo[playerid][pLeader] >= 1) { if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { if (gTeam[para1]==TEAM_GREEN && PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255) { if(PlayerInfo[para1][pFrakSperre] == 0) { GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); printf("AdmCmd: %s hat %s in die Fraktion %s eingeladen.", sendername, giveplayer,Fracs[leader-1]); format(string, sizeof(string), " Du wurdest in die Fraktion %s von Leader %s eingeladen.",Fracs[leader-1], sendername); SendClientMessage(para1, COLOR_LIGHTBLUE, string); SendClientMessage(para1, COLOR_GRAD2, " Um die Einladung anzunehmen: /einladung annehmen"); //SendClientMessage(para1, COLOR_GRAD2, " Um die Einladung abzulehnen: /einladung ablehnen"); format(string, sizeof(string), " Du hast %s in die Fraktion %s eingeladen.", giveplayer,Fracs[leader-1]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); SendClientMessage(playerid, COLOR_GRAD2, " Der Spieler muss nun deine Einladung annehmen oder ablehnen."); new iyear, imonth,iday; getdate(iyear, imonth, iday); format(string, sizeof(string), "%s[Level:%d] wurde von %s in die Fraktion %s eingeladen (%d-%d-%d)", giveplayer,PlayerInfo[para1][pLevel],sendername,Fracs[leader-1],imonth,iday,iyear); MemberLog(string); Eingeladen[para1] = leader; } else { SendClientMessage(playerid, COLOR_GREY, " Dieser Spieler hat eine Fraktions-Sperre"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " Dieser Spieler ist in einer anderen Fraktion oder bereits ein Fraktionsmitglied."); return 1; } } }//not connected } else { SendClientMessage(playerid, COLOR_GRAD1, " Nur der Leader kann diesen Befehl nutzen!"); } return 1; }
    if(strcmp(cmd,"/einladung",true) == 0) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "BENUTZUNG: /einladung [annehmen/ablehnen]"); return 1; } if(Eingeladen[playerid] == 0) { SendClientMessage(playerid, COLOR_GRAD2, "Du wurdest in keine Fraktion eingeladen!"); return 1; } if(strcmp(tmp,"annehmen",true) == 0) { if(Eingeladen[playerid] == 1) { PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; ChosenSkin[playerid] = 280; SetPlayerSkin(playerid, 280); } else if(Eingeladen[playerid] == 2) { PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; ChosenSkin[playerid] = 280; SetPlayerSkin(playerid, 280); } else if(Eingeladen[playerid] == 3) { PlayerInfo[playerid][pTeam] = 2; gTeam[playerid] = 2; ChosenSkin[playerid] = 287; SetPlayerSkin(playerid, 287); } else if(Eingeladen[playerid] == 4) { PlayerInfo[playerid][pTeam] = 1; gTeam[playerid] = 1; ChosenSkin[playerid] = 70; SetPlayerSkin(playerid, 70); } else if(Eingeladen[playerid] == 5) { PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; ChosenSkin[playerid] = 258; SetPlayerSkin(playerid, 120); } else if(Eingeladen[playerid] == 6) { PlayerInfo[playerid][pTeam] = 5; gTeam[playerid] = 5; ChosenSkin[playerid] = 294; SetPlayerSkin(playerid, 294); } else if(Eingeladen[playerid] == 7) { PlayerInfo[playerid][pTeam] = 7; gTeam[playerid] = 7; ChosenSkin[playerid] = 164; SetPlayerSkin(playerid, 164); } else if(Eingeladen[playerid] == 8) { PlayerInfo[playerid][pTeam] = 8; gTeam[playerid] = 8; ChosenSkin[playerid] = 250; SetPlayerSkin(playerid, 250); } else if(Eingeladen[playerid] == 9) { PlayerInfo[playerid][pTeam] = 9; gTeam[playerid] = 9; ChosenSkin[playerid] = 187; SetPlayerSkin(playerid, 187); } else if(Eingeladen[playerid] == 10) { PlayerInfo[playerid][pTeam] = 10; gTeam[playerid] = 10; ChosenSkin[playerid] = 255; SetPlayerSkin(playerid, 255); } else if(Eingeladen[playerid] == 11) { PlayerInfo[playerid][pTeam] = 11; gTeam[playerid] = 11; ChosenSkin[playerid] = 240; SetPlayerSkin(playerid, 240); } else if(Eingeladen[playerid] == 12) { PlayerInfo[playerid][pTeam] = 12; gTeam[playerid] = 12; ChosenSkin[playerid] = 118; SetPlayerSkin(playerid, 118); }//Triaden else if(Eingeladen[playerid] == 13) { PlayerInfo[playerid][pTeam] = 13; gTeam[playerid] = 13; ChosenSkin[playerid] = 105; SetPlayerSkin(playerid, 105); }//Grove else if(Eingeladen[playerid] == 14) { PlayerInfo[playerid][pTeam] = 14; gTeam[playerid] = 14; ChosenSkin[playerid] = 102; SetPlayerSkin(playerid, 102); }//Bloods else if(Eingeladen[playerid] == 15) { PlayerInfo[playerid][pTeam] = 15; gTeam[playerid] = 15; ChosenSkin[playerid] = 185; SetPlayerSkin(playerid, 185); }//Sf Biker Club else if(Eingeladen[playerid] == 16) { PlayerInfo[playerid][pTeam] = 16; gTeam[playerid] = 16; ChosenSkin[playerid] = 108; SetPlayerSkin(playerid, 108); }//Los Santos MaraSalvatrucha else if(Eingeladen[playerid] == 17) { PlayerInfo[playerid][pTeam] = 17; gTeam[playerid] = 17; ChosenSkin[playerid] = 114; SetPlayerSkin(playerid, 114); }//Varios Los Crips else if(Eingeladen[playerid] == 18) { PlayerInfo[playerid][pTeam] = 18; gTeam[playerid] = 18; ChosenSkin[playerid] = 173; SetPlayerSkin(playerid, 173); }//Los Santos Rifa else if(Eingeladen[playerid] == 19) { PlayerInfo[playerid][pTeam] = 19; gTeam[playerid] = 19; ChosenSkin[playerid] = 234; SetPlayerSkin(playerid, 234); }//West Coust Customs else if(Eingeladen[playerid] == 20) { PlayerInfo[playerid][pTeam] = 20; gTeam[playerid] = 20; ChosenSkin[playerid] = 220; SetPlayerSkin(playerid, 220); } else if(Eingeladen[playerid] == 21) { PlayerInfo[playerid][pTeam] = 21; gTeam[playerid] = 21; ChosenSkin[playerid] = 28; SetPlayerSkin(playerid, 28); } else if(Eingeladen[playerid] == 22) { PlayerInfo[playerid][pTeam] = 22; gTeam[playerid] = 22; ChosenSkin[playerid] = 274; SetPlayerSkin(playerid, 274); } else if(Eingeladen[playerid] == 23) { PlayerInfo[playerid][pTeam] = 23; gTeam[playerid] = 23; ChosenSkin[playerid] = 133; SetPlayerSkin(playerid, 133); } else if(Eingeladen[playerid] == 24) { PlayerInfo[playerid][pTeam] = 24; gTeam[playerid] = 24; ChosenSkin[playerid] = 255; SetPlayerSkin(playerid, 255); } else { return 1; } GetPlayerName(playerid,sendername,sizeof(sendername)); PlayerInfo[playerid][pMember] = Eingeladen[playerid]; PlayerInfo[playerid][pRank] = 1; format(string,sizeof(string)," %s hat die Einladung in die Fraktion %s angenommen!",sendername,Fracs[Eingeladen[playerid]-1]); for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pLeader] == Eingeladen[playerid]) { SendClientMessage(i,COLOR_LIGHTBLUE,string); } } } SetPlayerInterior(playerid,0); new rand = random(sizeof(gInviteSpawns)); SetPlayerPos(playerid, gInviteSpawns[rand][0], gInviteSpawns[rand][1], gInviteSpawns[rand][2]); // Warp the player SetPlayerFacingAngle(playerid, gInviteSpawns[rand][3]); SetPlayerCameraPos(playerid,gInviteSpawns[rand][0] + 3, gInviteSpawns[rand][1], gInviteSpawns[rand][2]); SetPlayerCameraLookAt(playerid,gInviteSpawns[rand][0], gInviteSpawns[rand][1], gInviteSpawns[rand][2]); FreezePlayer(playerid); SelectChar[playerid] = 255; Eingeladen[playerid] = 0; SelectCharID[playerid] = PlayerInfo[playerid][pMember]; SelectCharPlace[playerid] = 1; PlayerInfo[playerid][pModel] = ChosenSkin[playerid]; PlayerInfo[playerid][pChar] = ChosenSkin[playerid]; SendClientMessage(playerid, COLOR_GRAD5, " Du kannst mit /hilf deine neuen Fraktionsbefehle betrachten"); SendClientMessage(playerid, COLOR_LIGHTRED, "* Benutze 'weiter' um dir den Charakter auszusuchen den du gerne benutzen möchtest."); SendClientMessage(playerid, COLOR_LIGHTRED, "* Wenn du den richtigen gefunden hast, gib 'fertig' ein."); } else if(strcmp(tmp,"ablehnen",true) == 0) { format(string,sizeof(string)," %s hat die Einladung in die Fraktion %s abgelehnt!",sendername,Fracs[Eingeladen[playerid]-1]); for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pLeader] == Eingeladen[playerid]) { SendClientMessage(i,COLOR_LIGHTBLUE,string); } } } Eingeladen[playerid] = 0; } else { SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /einladung [annehmen/ablehnen]"); } return 1; }



    Hier :)