PDA

View Full Version : How to


weedxd
17/05/2014, 07:27 AM
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

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{

Hwang
17/05/2014, 07:42 AM
Example:

if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
OnPlayerCommandText(playerid, "/command");
}
}


ZCMD:


if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
cmd_command(playerid);
}
}

cmd_command, change u name.

weedxd
17/05/2014, 07:44 AM
Example:

if (PRESSED(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 754.16119, -40.84430, 999.99481))
{
OnPlayerCommandText(playerid, "/command");
}
}


ZCMD:


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 ?

Hwang
17/05/2014, 07:46 AM
And for Dcmd ? I have to change cmd_robstore to dcmd_robstore ?

dcmd uses OnPlayerCommandText infrastructure, for her:
OnPlayerCommandText(playerid, "/rob");

Ciandlah
17/05/2014, 07:48 AM
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.

weedxd
17/05/2014, 07:48 AM
dcmd uses OnPlayerCommandText infrastructure, for her:
OnPlayerCommandText(playerid, "/rob");

Oh okey thanks :)