How to
#1

I wanted to ask how can i bind a command to a button? like at this situation when I want to start robbery in a shop i have to press alt.


Edit For the moment i have only this

PHP код:
    public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
  if (
PRESSED(KEY_CROUCH))
    {
     if(
IsPlayerInRangeOfPoint(playerid7.0754.16119, -40.84430999.99481))
        { 
Reply
#2

Example:
pawn Код:
if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
OnPlayerCommandText(playerid, "/command");
}
}
ZCMD:

pawn Код:
if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
cmd_command(playerid);
}
}
cmd_command, change u name.
Reply
#3

Quote:
Originally Posted by Hwang
Посмотреть сообщение
Example:
pawn Код:
if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
OnPlayerCommandText(playerid, "/command");
}
}
ZCMD:

pawn Код:
if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
cmd_command(playerid);
}
}
cmd_command, change u name.
And for Dcmd ? I have to change cmd_robstore to dcmd_robstore ?
Reply
#4

Quote:
Originally Posted by weedxd
Посмотреть сообщение
And for Dcmd ? I have to change cmd_robstore to dcmd_robstore ?
dcmd uses OnPlayerCommandText infrastructure, for her:
pawn Код:
OnPlayerCommandText(playerid, "/rob");
Reply
#5

It is safer to just copy and past your /rob command under that line instead of making a forwarded function.

Its better in the long run because it will not be calling a process to go to another process you have made.
Reply
#6

Quote:
Originally Posted by Hwang
Посмотреть сообщение
dcmd uses OnPlayerCommandText infrastructure, for her:
pawn Код:
OnPlayerCommandText(playerid, "/rob");
Oh okey thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)