[Pomoc] strcmp

Započeo Glisa, Februar 26, 2012, 14:57:16 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:CLRP edit
Detaljan opis problema: Mozete li mi ove komande prebaciti u strcmp?
Deo skripte:
Citat//---------------------------[DCMD Commands!!]--------------------------------------------
dcmd_specplayer(playerid, params[])
{
   new Giveplayerid, Ime[256], String[256], Ime2[256];
   if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
   {
   if (sscanf(params, "d", Giveplayerid)) SendClientMessage(playerid,COLOR_WHITE, "SERVER: /recon [Playerid]");
   else if (!IsPlayerConnected(Giveplayerid)) SendClientMessage(playerid,COLOR_PURPLE,"Player not connected?");
   else
   {
   if ( Specing[Giveplayerid] == 1 )
   {
   SendClientMessage(playerid, COLOR_RED, "   The person you have tried to spec is spectating someone else.");
   }
   else
   {
    GetPlayerName(playerid, Ime, 256);
   GetPlayerName(Giveplayerid, Ime2, 256);
   format(String, 256, "[%i] %s is now spectating [%i] %s",playerid, Ime,Giveplayerid, Ime2);
   CallLocalFunction("ircRemoteSay", "iss", 1, "#FSE", String);
   Specing[playerid] = 1;
   }
   if ( !IsPlayerInAnyVehicle(Giveplayerid) )
   {
   TogglePlayerSpectating(playerid, 1);
   PlayerSpectatePlayer(playerid, Giveplayerid);
   SetPlayerInterior(playerid,GetPlayerInterior(Giveplayerid));
   SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(Giveplayerid));
   return 1;
   }
   else
   {
   TogglePlayerSpectating(playerid, 1);
   PlayerSpectateVehicle(playerid, GetPlayerVehicleID(Giveplayerid));
   SetPlayerInterior(playerid,GetPlayerInterior(Giveplayerid));
   SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(Giveplayerid));
   return 1;
   }
   }
   }
   return 1;
}

dcmd_specoff(playerid, params[])
{
   #pragma unused params
   TogglePlayerSpectating(playerid, 0);
   SetTimerEx("PosAfterSpec",3000,0,"d",playerid);
   if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
   {
       if(Specing[playerid] != 0)
       {
            Specing[playerid] = 0;
         GivePlayerMoney(playerid,100)
      }
      else
      {
      SendClientMessage(playerid,COLOR_WHITE,"Trenutno nikoga ne specujete");
      }
   }
     else
     {
      SendClientMessage(playerid, COLOR_WHITE, "(greska)Niste autorizovani da koristite ovu komandu!");
   }
   return 1;
}
dcmd_xgoto(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] >= 5)
   {
      new Float:x, Float:y, Float:z;
      new string[100];
      if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, COLOR_GREY, ""svpl"Koriscenje:{FFFFFF} /xgoto [X Float] [Y Float] [Z Float]");
      else
      {
          if(IsPlayerInAnyVehicle(playerid))
          {
              SetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
         }
         else
         {
             SetPlayerPos(playerid, x, y, z);
         }
          format(string, sizeof(string), "You've set your coord to %f, %f, %f", x, y, z);
          SendClientMessage(playerid, 0xBBBBBBAA, string);
       }
   }
   return 1;
}
//warn cmd
dcmd_upozorenje(playerid,params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 1) {
       new tmp[256], tmp2[256], Index;      tmp = strtok(params,Index), tmp2 = strtok(params,Index);
       if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, ""svpl"Koriscenje:{FFFFFF} /upozorenje [ID Igraca] [razlog]");
       new warned = strval(tmp), str[128];
       new sendername[MAX_PLAYER_NAME];
       new giveplayer[MAX_PLAYER_NAME];
   //   if(PlayerInfo[warned][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
       if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID) {
          if(warned != playerid) {
             ABroadCast(warned,"WARN",1);
            PlayerInfo[warned][pWarns]++;
            if( PlayerInfo[warned][pWarns] == MAX_WARNINGS) {
               GetPlayerName(warned, sendername, sizeof(sendername));
               format(str, sizeof (str), "*** \"%s\" je banovan zbog opomena \"%s\".  (Razlog: %s) (Warn: %d/5)***",sendername, params[1+strlen(tmp)], PlayerInfo[warned][pWarns]);
               SendClientMessageToAll(COLOR_RED, str);
               BanLog(str);
               Ban(warned);
               return PlayerInfo[warned][pWarns] = 0;
            } else {
               GetPlayerName(warned, sendername, sizeof(sendername));
               GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
               format(str, sizeof (str), "***Admin \"%s\" je dao \"%s\" a warn.  (Reason: %s) (Warning: %d/5)***",giveplayer,sendername, params[1+strlen(tmp)], PlayerInfo[warned][pWarns]);
               return SendClientMessageToAll(COLOR_YELLOW, str);
            }
         } else return SendClientMessage(playerid, COLOR_RED, "Ne mozete dati sebi warn");
      } else return SendClientMessage(playerid, COLOR_RED, "Igrac nije online!");
   } else return SendClientMessage(playerid,COLOR_RED,"(greska)Niste autorizovani da koristite ovu komandu!");
}
Neke slike/video za lakse dobivanje pomoci(neobavezno)://

Skripta koju koristim:CLRP edit
Detaljni opis problema: Mozete li mi napraviti da obicni admini 1,2,3,4,1337 nemogu se port do head admina ali da se head moze port do heada
Evo komande /goto
Deo skripte:
Citatif(strcmp(cmd, "/goto", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
         tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, ""svpl"Koriscenje:{FFFFFF} /goto [ID Igraca]");
            return 1;
         }
         new Float:plocx,Float:plocy,Float:plocz;
         new plo;
         plo = ReturnUser(tmp);
         if (IsPlayerConnected(plo))
         {
             if(plo != INVALID_PLAYER_ID)
             {
               if (PlayerInfo[plo][pAdmin] > 1337)
               {
                  SendClientMessage(playerid, COLOR_GRAD1, "Nemozes se teleportovati do heada.");
                  return 1;
               }
               if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
               {
                  if(Spectate[playerid] != 255)
                  {
                     Spectate[playerid] = 256;
                  }
                  GetPlayerPos(plo, plocx, plocy, plocz);
                  if(PlayerInfo[plo][pInt] > 0)
                  {
                     SetPlayerInterior(playerid,PlayerInfo[plo][pInt]);
                     PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt];
                     PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal];
                  }
                  if(PlayerInfo[playerid][pInt] == 0)
                  {
                     SetPlayerInterior(playerid,0);
                  }
                  if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8
                  {
                     SetPlayerInterior(playerid,1);
                     PlayerInfo[playerid][pInt] = 1;
                  }
                  if (GetPlayerState(playerid) == 2)
                  {
                     new tmpcar = GetPlayerVehicleID(playerid);
                     SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                     TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                  }
                  else
                  {
                     SetPlayerPos(playerid,plocx,plocy+2, plocz);
                  }
                  SendClientMessage(playerid, COLOR_GRAD1, "Teleportovani ste");
               }
               else
               {
                  SendClientMessage(playerid, COLOR_GRAD1, "(greska)Niste autorizovani da koristite ovu komandu!");
               }
            }
         }
         else
         {
            format(string, sizeof(string), "   %d nije aktivan igrac.", plo);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }

if(strcmp(cmd, "/goto", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
         tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, ""svpl"Koriscenje:{FFFFFF} /goto [ID Igraca]");
            return 1;
         }
         new Float:plocx,Float:plocy,Float:plocz;
         new plo;
         plo = ReturnUser(tmp);
         if (IsPlayerConnected(plo))
         {
             if(plo != INVALID_PLAYER_ID)
             {
               if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >= 1)
               {
                  if(Spectate[playerid] != 255)
                  {
                     Spectate[playerid] = 256;
                  }
                  GetPlayerPos(plo, plocx, plocy, plocz);
                  if(PlayerInfo[plo][pInt] > 0)
                  {
                     SetPlayerInterior(playerid,PlayerInfo[plo][pInt]);
                     PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt];
                     PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal];
                  }
                  if(PlayerInfo[playerid][pInt] == 0)
                  {
                     SetPlayerInterior(playerid,0);
                  }
                  if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8
                  {
                     SetPlayerInterior(playerid,1);
                     PlayerInfo[playerid][pInt] = 1;
                  }
                  if (GetPlayerState(playerid) == 2)
                  {
                     new tmpcar = GetPlayerVehicleID(playerid);
                     SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                     TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                  }
                  else
                  {
                     SetPlayerPos(playerid,plocx,plocy+2, plocz);
                  }
                  SendClientMessage(playerid, COLOR_GRAD1, "Teleportovani ste");
               }
               else
               {
                  SendClientMessage(playerid, COLOR_GRAD1, "(greska)Niste autorizovani da koristite ovu komandu!");
               }
            }
         }
         else
         {
            format(string, sizeof(string), "   %d nije aktivan igrac.", plo);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }

â–º USKORO â—,,
•Reg/Log System [100%]•House System [80%]•Bizz System [50%] •Ownership system [90%] •Admin System [90%] •GM System [0%] •Stats System [100%] •Jail System [90%] •Job System [70%] •Event System [40%] •Bank System [60%] •Org/Mafije [35%] •Donator System [10%]
I najveci talenti gube se u neradu, zato nemoj traziti izgovor da ne znas nego naÄ'i resenje!