SA-MP Forums Archive
[HELP]Command Data - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Command Data (/showthread.php?tid=123940)



[HELP]Command Data - Zafire2008 - 28.01.2010

Hey i want to take data from command for example.. if i use /call 911.. i want take "911" if i use /said helloooo ... i want to take "helloooo" how i can do that?


Re: [HELP]Command Data - [HiC]TheKiller - 28.01.2010

Quote:
Originally Posted by Seif_
With a variable.
Nice explaination rofl .

Anyway, use DCMD and take the Params.


Re: [HELP]Command Data - Zafire2008 - 28.01.2010

Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by Seif_
With a variable.
Nice explaination rofl .

Anyway, use DCMD and take the Params.
Thx for the help ok i am going to use dcmd.. but a question params in this commando for example /call 911 .. params = 911 ? ... o i have to use another function for take 911?



Re: [HELP]Command Data - Miguel - 28.01.2010

Use dcmd + sscanf and here's an example:
pawn Код:
dcmd_call(playerid, params[])
{
  new
    pn, // phonenumber
    string[1]; // you'll need it later

  if(sscanf(params, "d", pn)) // d is the type of variable and pn is where we're going to store the value in params
  {
    SendClientMessage(playerid, COLOR, "Correct usage: /call [phone number]");
    return 1;
  }
  else if(pn == 911)
  {
    // call 911 stuff
  }
  else
  {
    // call any phone number
  }
  return 1;
}
You can store the values that are in params in variables.


Re: [HELP]Command Data - Zafire2008 - 28.01.2010

Quote:
Originally Posted by SAWC™
Use dcmd + sscanf and here's an example:
pawn Код:
dcmd_call(playerid, params[])
{
  new
    pn, // phonenumber
    string[1]; // you'll need it later

  if(sscanf(params, "d", pn)) // d is the type of variable and pn is where we're going to store the value in params
  {
    SendClientMessage(playerid, COLOR, "Correct usage: /call [phone number]");
    return 1;
  }
  else if(pn == 911)
  {
    // call 911 stuff
  }
  else
  {
    // call any phone number
  }

thxx forr that meen :D .. but if i want do the same but using words like this.. /job taxi ... and take taxi is not number.. qhat i need to do?
  return 1;
}
You can store the values that are in params in variables.



Re: [HELP]Command Data - Zafire2008 - 28.01.2010

I use that code with works but doesnt works