#include <a_samp>
new TrainingObj[MAX_PLAYERS];
#define DIALOG_ID_TRAINING (20)
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsValidPlayerObject(playerid, TrainingObj[playerid]))
DestroyPlayerObject(playerid, TrainingObj[playerid]);
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(weaponid == WEAPON_SNIPER && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
{
DestroyPlayerObject(playerid, TrainingObj[playerid]);
TrainingObj[playerid] = CreatePlayerObject(playerid, 902, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 200.0); // Then I will set random positions
}
return 1;
}
Seems like it will, but you need a way to execute it.
Currently it seems that it will only create a object if you shoot the specific object, that hasn't been created yet. Tested it too, and couldn't see anything being created. |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ID_TRAINING)
{
if(!response) return 0;
TrainingObj[playerid] = CreatePlayerObject(playerid, 902, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 200.0); /////////////
}
return 1;
}