SA-MP Forums Archive
if inputtext = players varible - 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: if inputtext = players varible (/showthread.php?tid=355896)



if inputtext = players varible - Slappybay - 01.07.2012

ok when i put in a variable through a dialog that is set to a players statistic, i want it to return the name :P

Код:
enum Playerstatistics
{
    description[255],
    description2[255],
}

for(new i=0;i<MAX_PLAYERS;i++) //loop for all players
{ 
    new string[128];
    if(strlen(inputtext) ==  Player[i][description] || strlen(inputtext) ==  Player[i][description2]))
    {
          format(string,sizeof(string),"%s",GetName(i));
          SendClientMessage(playerid,WHITE,string);
    }
    else
    {
         SendclientMessage(playerid,WHITE,"nothing was found");
    }
}



Re: if inputtext = players varible - Hawky133 - 01.07.2012

Hello.

So you're saying you have a dialog menu which displays all the statistics of a certain player?


Re: if inputtext = players varible - Slappybay - 01.07.2012

No. put it simple just when you enter a variable like "cake" in to the dialog and the players description = cake i want it to display their name.


Re: if inputtext = players varible - SuperViper - 01.07.2012

pawn Код:
if(!strcmp(string1, string2, true))



Re: if inputtext = players varible - qinaixiuor - 02.07.2012

i want it to display their name.


Re: if inputtext = players varible - Tee - 02.07.2012

pawn Код:
enum Playerstatistics
{
    description[255],
    description2[255],
}

for(new i=0;i<MAX_PLAYERS;i++) //loop for all players
{
    new string[128];
    if(!strcmp(Player[i][description],Player[i][description2],true))
    {
          format(string,sizeof(string),"%s",GetName(i));
          SendClientMessage(playerid,WHITE,string);
    }
    else
    {
         SendclientMessage(playerid,WHITE,"nothing was found");
    }
}



Re: if inputtext = players varible - Slappybay - 02.07.2012

Wouldn't that be if description = descritption2 ? i would like it to be what ever the player inputs that if its equal to either description or description2 if would return the name, but thank you all who replyed See if this gives a better view

Код:
enum Playerstatistics
{
    description[255],
    description2[255],
}
command(show,playerid,params[])
{
     ShowPlayerDialog(playerid,DIALOG_STYLE_INPUT,1,"Enter a description","enter the players description to get the name","ok","cancel");
     return 1;
} 

case 1:
{
    for(new i=0;i<MAX_PLAYERS;i++) //loop for all players 
    { 
         new string[128];
         if(!strcmp(Player[i][description],inputtext,true)) || !strcmp(Player[i][description2],inputtext,true))))
         {
              format(string,sizeof(string),"%s",GetName(i));
              SendClientMessage(playerid,WHITE,string);
         }
        else
        {
             SendClientMessage(playerid,WHITE,"nothing was found");
        }
    }
}



Re: if inputtext = players varible - Slappybay - 04.07.2012

*Bump


Re: if inputtext = players varible - Tee - 04.07.2012

I don't really understand you...


Re: if inputtext = players varible - MadeMan - 04.07.2012

Parameter order in ShowPlayerDialog is not right. dialogid comes before style

pawn Код:
command(show,playerid,params[])
{
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Enter a description","enter the players description to get the name","ok","cancel");
    return 1;
}
and this should work

pawn Код:
case 1:
{
    for(new i=0;i<MAX_PLAYERS;i++) //loop for all players
    {
        if(!strcmp(Player[i][description],inputtext,true) || !strcmp(Player[i][description2],inputtext,true))
        {
            SendClientMessage(playerid,WHITE,GetName(i));
            return 1;
        }
    }
    SendClientMessage(playerid,WHITE,"nothing was found");
}