zone Training - It will work for me?
#1

PHP код:
#include <a_samp>
new TrainingObj[MAX_PLAYERS];
#define DIALOG_ID_TRAINING  (20)
public OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
IsValidPlayerObject(playeridTrainingObj[playerid]))
        
DestroyPlayerObject(playeridTrainingObj[playerid]);
    return 
1;
}
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
weaponid == WEAPON_SNIPER && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
    {
        
DestroyPlayerObject(playeridTrainingObj[playerid]);
        
TrainingObj[playerid] = CreatePlayerObject(playerid9020.00.00.00.00.00.0200.0); // Then I will set random positions
    
}
    return 
1;

Reply
#2

I have not tested it but i think it will work if you create that object before you shot/runing the "OnPlayerWeaponShot" callback
Reply
#3

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

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
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.
/train

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_ID_TRAINING)
    {
        if(!
response) return 0;
        
TrainingObj[playerid] = CreatePlayerObject(playerid9020.00.00.00.00.00.0200.0); /////////////
    
}
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)