new TrainingObj[MAX_PLAYERS];
#define DIALOG_ID_TRAINING (20)
YCMD:train(playerid, params[], help)
{
#pragma unused params, help
TrainingObj[playerid] = 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 0;
}
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 == 34 && hittype == BULLET_HIT_TYPE_OBJECT && hitid == TrainingObj[playerid])
{
DestroyPlayerObject(playerid, TrainingObj[playerid]);
TrainingObj[playerid] = CreatePlayerObject(playerid, 19054, 1332.207397, 2194.804931, 11.023437, 0.0, 0.0, 0.0, 200.0);
SendClientMessage(playerid, -1, "הושמד ויצר חדש");
}
return 1;
}
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.
|
|
pawn Код:
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. |