GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: Fanni12 - 2013. január 20. - 21:24:57

Cím: Kulcsos probléma a PredLineRPG módban.
Írta: Fanni12 - 2013. január 20. - 21:24:57
Sziasztok.
Van a módomba egy olyan hogy /kulcsel , /kulcsel2 és két ugyan ilyen parancsot akarok de máshogy.
BE írja az illetõ a meg adott helyen a /eladautó parancsot (( /kulcsel )) És ilyenkór aki be írta a parancsot tõle elveszi a kulcsot.
És a (( /kulcsel2 ))-re is ezt akarom de ott meg a 2-es kulcsot veszi el. Parancsa ez legyen: /eladautó2
/kulcsel parancs kódja:
 

if(strcmp(cmd, \"/kulcsel\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"HASZNÁLAT: /kulcsel [JátékosID/NévRészlet]\");
      return 1;
   }
   new para1;
   para1 = ReturnUser(tmp);
   tmp = strtok(cmdtext, idx);
   if (Admin(playerid, 2))
   {
       if(IsPlayerConnected(para1))
       {
           if(para1 != INVALID_PLAYER_ID)
           {
               if(PlayerInfo[para1][pPcarkey] == 999)
               {
                   SendClientMessage(playerid, COLOR_GREY, \"A játékosnak nincs kocsija!\");
                   return 1;
               }
               new nev[32];
            GetPlayerName(playerid, nev, sizeof(nev));
               new kocsiid = PlayerInfo[para1][pPcarkey];
               CarInfo[kocsiid][cOwned] = 0;
                     strmid(CarInfo[kocsiid][cOwner], \"Dealership\", 0, strlen(\"Dealership\"), 999);
                     new Float:x,Float:y,Float:z;
                     new Float:a;
                     GetVehiclePos(kocsiid, x, y, z);
               GetVehicleZAngle(kocsiid, a);
               CarInfo[kocsiid][cLocationx] = x;
               CarInfo[kocsiid][cLocationy] = y;
               CarInfo[kocsiid][cLocationz] = z;
               CarInfo[kocsiid][cAngle] = a;
               SaveCarCoords();
               DestroyVehicle(kocsiid);
            CreateVehicle(CarInfo[kocsiid][cModel],CarInfo[kocsiid][cLocationx],CarInfo[kocsiid][cLocationy],CarInfo[kocsiid][cLocationz]+1.0,CarInfo[kocsiid][cAngle],CarInfo[kocsiid][cColorOne],CarInfo[kocsiid][cColorTwo],60000);
            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), \"%s elvette a kocsid kulcsát! (1.kocsi)\", nev);
            SendClientMessage(para1, COLOR_LIGHTRED, string);
            format(string, sizeof(string), \"Elvetted %s kocsikulcsát!\",giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            format(string, sizeof(string), \"<< Admin %s elvette %s kocsijának a kulcsát. Kocsi ID: %d (1.kocsi) >>\",nev,giveplayer,kocsiid);
            ABroadCast(COLOR_ADMIN,string,1);
            new h,mi,s,yy,m,d;
            getdate(yy,m,d);
            gettime(h,mi,s);
                format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d] %s elvette %s kocsijának a kulcsát. Kocsi ID: %d (1.kocsi)\",yy,m,d,h,mi,s,nev,giveplayer,kocsiid);
            LoOoG(stringx);
            PlayerInfo[para1][pPcarkey] = 999;
         }
      }//not connected
   }
   else
   {
      SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy 1-es admin!\");
   }
}
return 1;
}

 
És a /kulcsel2 parancs kódja:
 

if(strcmp(cmd, \"/kulcsel2\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"HASZNÁLAT: /kulcsel [JátékosID/NévRészlet]\");
      return 1;
   }
   new para1;
   para1 = ReturnUser(tmp);
   tmp = strtok(cmdtext, idx);
   if (Admin(playerid, 2))
   {
       if(IsPlayerConnected(para1))
       {
           if(para1 != INVALID_PLAYER_ID)
           {
               if(PlayerInfo[para1][pPcarkey] == 999)
               {
                   SendClientMessage(playerid, COLOR_GREY, \"A játékosnak nincs kocsija!\");
                   return 1;
               }
               new nev[32];
            GetPlayerName(playerid, nev, sizeof(nev));
               new kocsiid = PlayerInfo[para1][pPcarkey2];
               CarInfo[kocsiid][cOwned] = 0;
                     strmid(CarInfo[kocsiid][cOwner], \"Dealership\", 0, strlen(\"Dealership\"), 999);
                     new Float:x,Float:y,Float:z;
                     new Float:a;
                     GetVehiclePos(kocsiid, x, y, z);
               GetVehicleZAngle(kocsiid, a);
               CarInfo[kocsiid][cLocationx] = x;
               CarInfo[kocsiid][cLocationy] = y;
               CarInfo[kocsiid][cLocationz] = z;
               CarInfo[kocsiid][cAngle] = a;
               SaveCarCoords();
               DestroyVehicle(kocsiid);
            CreateVehicle(CarInfo[kocsiid][cModel],CarInfo[kocsiid][cLocationx],CarInfo[kocsiid][cLocationy],CarInfo[kocsiid][cLocationz]+1.0,CarInfo[kocsiid][cAngle],CarInfo[kocsiid][cColorOne],CarInfo[kocsiid][cColorTwo],60000);
            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), \"%s elvette a kocsid kulcsát! (2.kocsi)\", nev);
            SendClientMessage(para1, COLOR_LIGHTRED, string);
            format(string, sizeof(string), \"Elvetted %s kocsikulcsát!\",giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            format(string, sizeof(string), \"<< Admin %s elvette %s kocsijának a kulcsát. Kocsi ID: %d (2.kocsi)\",nev,giveplayer,kocsiid);
            ABroadCast(COLOR_ADMIN,string,1);
            new h,mi,s,yy,m,d;
            getdate(yy,m,d);
            gettime(h,mi,s);
                format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d] %s elvette %s kocsijának a kulcsát. Kocsi ID: %d (2.kocsi) >>\",yy,m,d,h,mi,s,nev,giveplayer,kocsiid);
            LoOoG(stringx);
            PlayerInfo[para1][pPcarkey2] = 999;
         }
      }//not connected
   }
   else
   {
      SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy 1-es admin!\");
   }
}
return 1;
}
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: filip95 - 2013. január 20. - 21:38:37

if(strcmp(cmd, \"/eladauto\", true) == 0)
        {
                            if(IsPlayerConnected(playerid))
                            {
                                if(playerid != INVALID_PLAYER_ID)
                                {
                                    if(PlayerInfo[playerid][pPcarkey] == 999)
                                    {
                                        SendClientMessage(playerid, COLOR_GREY, \"Nincs kocsid!\");
                                        return 1;
                                    }
                                    new nev[32];
                                                GetPlayerName(playerid, nev, sizeof(nev));
                                    new kocsiid = PlayerInfo[playerid][pPcarkey];
                                    CarInfo[kocsiid][cOwned] = 0;
                                        strmid(CarInfo[kocsiid][cOwner], \"Dealership\", 0, strlen(\"Dealership\"), 999);
                                        new Float:x,Float:y,Float:z;
                                        new Float:a;
                                        GetVehiclePos(kocsiid, x, y, z);
                                        GetVehicleZAngle(kocsiid, a);
                                        CarInfo[kocsiid][cLocationx] = x;
                                        CarInfo[kocsiid][cLocationy] = y;
                                        CarInfo[kocsiid][cLocationz] = z;
                                        CarInfo[kocsiid][cAngle] = a;
                                        SaveCarCoords();
                                        DestroyVehicle(kocsiid);
                                                CreateVehicle(CarInfo[kocsiid][cModel],CarInfo[kocsiid][cLocationx],CarInfo[kocsiid][cLocationy],CarInfo[kocsiid][cLocationz]+1.0,CarInfo[kocsiid][cAngle],CarInfo[kocsiid][cColorOne],CarInfo[kocsiid][cColorTwo],60000);
                                                GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
                                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                                PlayerInfo[playerid][pPcarkey] = 999;
                                        }
                                }//not connected
 
                return 1;
        }

 
Nem tudom h jóe nem teszteltem, csak gyors itt komentbe átírtam :)
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: Fanni12 - 2013. január 20. - 21:47:05
Szia!
Aza gond hogy nem látom hogy hol veszi el az 1-es kulcsot, 2-est.. Azért rendesen leír hatad volna :D
Meg nekem 2 kell nem csak az 1-es kulcs hanem a 2-es is :)
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: ZyZu. - 2013. január 20. - 21:48:55
Vagyis egyszere vegye el mind a kettõ kulcsot?
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: filip95 - 2013. január 20. - 21:49:49
A 2est most írom ja és az 1esben így veszed el a kocsit:
DestroyVehicle(kocsiid); //kocsiid helyére ugye a vehicleid vagy változó pl: pcar[playerid]
PlayerInfo[playerid][pPcarkey] = 999; //Itt meg a kocsikulcsnak ad 999es számot mivel gondolom az nincs használatban
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: Fanni12 - 2013. január 20. - 22:03:07
ZyZu:
Nem ugy értetem. Hogy /eladautó akkor elveszi az 1-est és akkor még egy parancs a /eladautó2 és ez meg a 2-es kocsiját vegye el.
Filip95:
A pPcarkey-nél hogy ha azt akarom hogy ne az irja neki hogy 999 akkor lehet az is hogy Nincs? Vagy csak szám lehet? Mert arra rá jöttem hogy hol kell át írni.
Cím: Kulcsos probléma a PredLineRPG módban.
Írta: filip95 - 2013. január 21. - 11:19:02
Fanni akkor a pcarkey-nek a változóját változtasd így:
változó[128]
és a pcarkey-hez írsz egy olyat hogy false <- ez a hamis
ha azt írod true <- akkor igaz