SA-MP Forums Archive
Problem with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with command (/showthread.php?tid=309485)



Problem with command - Setkus - 07.01.2012

Hi, guys!
I have a problem. I dont know how to fix it. Here is the code:

pawn Код:
if(!strcmp(cmdtext, "/thing", true,6))
   {
       if(playerDB[playerid][specialybe]!=4){SendClientMessage(playerid,COLOR," Its not for you."); return 1;}
                if(cmdtext[6]==0){SendClientMessage(playerid, BLUE, "* Thing for player: /thing [player name]"); return 1;}
            new vardas[MAX_PLAYER_NAME];
            strmid(vardas,cmdtext[7],0,MAX_PLAYER_NAME);
            new id = GetPlayeridMid(vardas);
            if (id == INVALID_PLAYER_ID){ SendClientMessage(playerid, RED, "* Invalid player"); return 1;}
            if (id == playerid){ SendClientMessage(playerid, RED, "* What?!"); return 1;}
      new Float:Coo[3];
      GetPlayerPos(id,Coo[0],Coo[1],Coo[2]);
      if(!PlayerToPoint(5, playerid, Coo[0],Coo[1],Coo[2])){SendClientMessage(playerid, RED, "* The player is to far"); return 1;}

        if(playerDB[id][vmegzas])
       {
          SendClientMessage(playerid,COLOR,"* The player have the thing.");
          return 1;
      }

       if(GetPlayerMoneyA(playerid)<1000)
       {
          SendClientMessage(playerid,COLOR," it cost1000LT.");
          return 1;
      }

      GivePlayerMoneyA(playerid,-1000);
        SendClientMessage(playerid,COLOR,"* Player has now test.");
        new msg[512];
    format(msg,sizeof(msg),"want it? Price1000LT.",id);
    ShowPlayerDialog(playerid,8088,DIALOG_STYLE_MSGBOX,"Thing:",msg,"Yes","No");
      return 1;
    }
And when I type /thing it says "what?" Well, itr should says: "Thing for player: /thing [player name]" But it isnt. So could you help me? I hope you understand me. Thanks for any advice


Re: Problem with command - Setkus - 07.01.2012

Ok, but when I delete it and when I type /thing (part of a player name) it says invalid id. Whats wrong?


Re: Problem with command - Setkus - 07.01.2012

Aš rašau vardą, o kaip tada padaryti, kad galėčiau rašyti vardą, o ne id? Pvz/ thing (vardo dalis),o ne /thing (ID)?


Re: Problem with command - Setkus - 07.01.2012

Anyone help me?


Re: Problem with command - tyler12 - 07.01.2012

As said above
Use sscanf!