[HELP]Command Data
#1

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?
Reply
#2

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

Anyway, use DCMD and take the Params.
Reply
#3

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?
Reply
#4

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.
Reply
#5

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.
Reply
#6

I use that code with works but doesnt works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)