this is not working =/
#1

this is not working =/

PHP код:
new TrainingObj[MAX_PLAYERS];
#define DIALOG_ID_TRAINING  (20)
YCMD:train(playeridparams[], help)
{
    
#pragma unused params, help
     
TrainingObj[playerid] = CreatePlayerObject(playerid190541332.2073972194.80493111.0234370.00.00.0200.0);
    
SetPlayerPos(playerid1332.2073972194.80493111.023437);
    
SetPlayerVirtualWorld(playeridplayerid+1);
       
GivePlayerWeapon(playerid34500);
    return 
0;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
IsValidPlayerObject(playeridTrainingObj[playerid]))
        
DestroyPlayerObject(playeridTrainingObj[playerid]);
    return 
1;
}
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
weaponid == 34 && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
    {
        
DestroyPlayerObject(playeridTrainingObj[playerid]);
        
TrainingObj[playerid] = CreatePlayerObject(playerid190541332.2073972194.80493111.0234370.00.00.0200.0);
        
SendClientMessage(playerid, -1"הושמד ויצר חדש");
    }
    return 
1;

Reply
#2

pawn Код:
new TrainingObj;

#define DIALOG_ID_TRAINING  (20)

YCMD:train(playerid, params[], help)
{
    #pragma unused params, help
    TrainingObj = CreatePlayerObject(playerid, 19054, 1332.207397, 2194.804931, 11.023437, 0.0, 0.0, 0.0, 200.0);
    SetPlayerPos(playerid, 1332.207397, 2194.804931, 11.023437);
    SetPlayerVirtualWorld(playerid, playerid+1);
    GivePlayerWeapon(playerid, 34, 500);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    DestroyPlayerObject(playerid, TrainingObj[playerid]);
    return 1;
}

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(weaponid == 34 && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
    {
        DestroyPlayerObject(playerid, TrainingObj);
        TrainingObj[playerid] = CreatePlayerObject(playerid, 19054, 1332.207397, 2194.804931, 11.023437, 0.0, 0.0, 0.0, 200.0);
        SendClientMessage(playerid, -1, "הושמד ויצר חדש");
    }
    return 1;
}
Actually, you don't need [MAX_PLAYERS], because it's only an object, and you defined and created him as a player object. So, you just waste your time writing [playerid], every time for object.

At command you returned 0. I think, that's the problem.

Anyway, please, at another topic explain us about errors when compilling (what errors), or what's exactly not working.
Reply
#3

Quote:
Originally Posted by HY
Посмотреть сообщение
Actually, you don't need [MAX_PLAYERS], because it's only an object, and you defined and created him as a player object. So, you just waste your time writing [playerid], every time for object.
Are you kidding me?!

@_Application_: Please ignore HY's post, he's giving you wrong information except for the return 0 part.
Can you let us know WHAT isn't working?
Reply
#4

Quote:
Originally Posted by HY
Посмотреть сообщение
pawn Код:
new TrainingObj;

#define DIALOG_ID_TRAINING  (20)

YCMD:train(playerid, params[], help)
{
    #pragma unused params, help
    TrainingObj = CreatePlayerObject(playerid, 19054, 1332.207397, 2194.804931, 11.023437, 0.0, 0.0, 0.0, 200.0);
    SetPlayerPos(playerid, 1332.207397, 2194.804931, 11.023437);
    SetPlayerVirtualWorld(playerid, playerid+1);
    GivePlayerWeapon(playerid, 34, 500);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    DestroyPlayerObject(playerid, TrainingObj[playerid]);
    return 1;
}

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(weaponid == 34 && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
    {
        DestroyPlayerObject(playerid, TrainingObj);
        TrainingObj[playerid] = CreatePlayerObject(playerid, 19054, 1332.207397, 2194.804931, 11.023437, 0.0, 0.0, 0.0, 200.0);
        SendClientMessage(playerid, -1, "הושמד ויצר חדש");
    }
    return 1;
}
Actually, you don't need [MAX_PLAYERS], because it's only an object, and you defined and created him as a player object. So, you just waste your time writing [playerid], every time for object.

At command you returned 0. I think, that's the problem.

Anyway, please, at another topic explain us about errors when compilling (what errors), or what's exactly not working.
This must be a joke.


You must use MAX_PLAYERS,if you attatch something to a playerid. If everyone was going to see it, it wasn't important, but this is only for one player a playerid so it's needed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)