27.10.2010, 01:40
It's bit complicated...
First, you check if the player is pressing CTRL, if it is then create an object in front of the player. After creating this object, set a timer to destroy it.
You'll need GetXYInFrontOfPlayer and the object angle to align it.
First, you check if the player is pressing CTRL, if it is then create an object in front of the player. After creating this object, set a timer to destroy it.
pawn Код:
new GlobalVarForObject[MAX_PLAYERS]; // this is a global variable to store object's ID
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & CTRL_KEY_HERE) // you've gotta change it by yourself
{
DestroyObject(GlobalVarForObject[playerid]); // if there's still an object we delete it
GlobalVarForObject[playerid] = CreateObject(/*object params...*/); // replace by object param, just like modelid and coordinates
SetTimerEx("DestroyRamp", TIME_HERE, false, "i", playerid); // TIME_HERE has to be replaced by the time of the ramp in milliseconds
}
return 1;
}
forward DestroyRamp(playerid);
public DestroyRamp(playerid) // this callback destroy our ramp
{
DestroyObject(GlobalVarForObject[playerid]); // we destroy the ramp created by the x playerid
return 1;
}