SA-MP Forums Archive
zone Training - It will work for me? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: zone Training - It will work for me? (/showthread.php?tid=553772)



zone Training - It will work for me? - _Application_ - 31.12.2014

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;




Re: zone Training - It will work for me? - Pasa - 31.12.2014

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


Re: zone Training - It will work for me? - CalvinC - 31.12.2014

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.


Re: zone Training - It will work for me? - _Application_ - 31.12.2014

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;