Attached Player Object.
#1

I have this problem, When player death/spawn the object that attached on player will be removed
Why?

How i can stop this?
Reply
#2

can you show your OnPlayerDeath or OnPlayerSpawn Callbacks ?

(EDIT :- is there any RemovePlayerAttachedObject on OnPlayerDeath or OnPlayerSpawn Callbacks ?)
Reply
#3

public OnPlayerSpawn(playerid)
{
useing1[playerid] = 0;
useing2[playerid] = 0 ;
useing3[playerid] = 0;
useing4[playerid] = 0;
useing5[playerid] = 0;
useing6[playerid] = 0;
useing7[playerid] = 0;
useing8[playerid] = 0;
useing9[playerid] = 0;
useing10[playerid] = 0;
useing11[playerid] = 0;
useing12[playerid] = 0;
useing13[playerid] = 0;
useing14[playerid] = 0;
useing15[playerid] = 0;
useing16[playerid] = 0;
useing17[playerid] = 0;
useing18[playerid] = 0;
useing19[playerid] = 0;
useing20[playerid] = 0;
useing21[playerid] = 0;
useing22[playerid] = 0;
useing23[playerid] = 0;
useing24[playerid] = 0;
useing25[playerid] = 0;
useing26[playerid] = 0;
useing27[playerid] = 0;
useing28[playerid] = 0;
useing29[playerid] = 0;
useing30[playerid] = 0;
useing31[playerid] = 0;
useing32[playerid] = 0;
useing33[playerid] = 0;
useing34[playerid] = 0;
useing35[playerid] = 0;
useing36[playerid] = 0;
useing37[playerid] = 0;
useing38[playerid] = 0;
useing39[playerid] = 0;
useing40[playerid] = 0;
useing41[playerid] = 0;
useing42[playerid] = 0;
useing43[playerid] = 0;
armoured[playerid] = 0;
healed[playerid] = 0;
Handsup[playerid] = 0;
healedall[playerid] = 0;
armouredall[playerid] = 0;
Fished[playerid] = 0;
killingstreak[playerid] = 0;
JUMPT[playerid] = 0;
Launched[playerid] = 0;
AntiSpawnkilling[playerid] = 1;
RageQuit[playerid] = 0;
Animation[playerid] = 0;
Locked[playerid] = 0;
TempLogin[playerid] = 0;
MadeFire[playerid] = 1;
StaffChat[playerid] = 0;
Newname[playerid] = 0;
Suit[playerid] = 0;
Attached[playerid] = 0;
Spawned[playerid] = 1;
InBike[playerid] = 0;
Spawning[playerid] = 1;
Spawningkilled[playerid] = 0;
SetCameraBehindPlayer(playerid);
TextDrawShowForPlayer(playerid, website);
TextDrawShowForPlayer(playerid, HealthBar[0]);
AdminHide(playerid);
FixSkin(playerid);
UpdateTextDraw(playerid);
ArmourCheck(playerid);
ResetPlayerWeapons(playerid);
SkinCheck(playerid);
SpawnPointCheck(playerid);
ColorCheck(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoneyEx(playerid, Player[playerid][pCash]);
SetPlayerHealth(playerid, 100);
TogglePlayerControllable(playerid, 0);
GangZoneShowForAll(Area1, 0x0300B1AA);
GangZoneShowForAll(AreaBlue2, 0x0300B1AA);
GangZoneShowForAll(Area2, 0xB60101AA);
if(gPlayerAnimLibsPreloaded[playerid] == 0)
{
gPlayerAnimLibsPreloaded[playerid] = 1;
}
SetTimerEx("AntiSpawnKill", 5000, false, "i", playerid);
SetTimerEx("SpawningPlayer", 13000, false, "i", playerid);
SetTimerEx("ReloadPlayer", 3000, false, "i", playerid);
if(!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
if(FirstJoin[playerid] == 1)
{
Player[playerid][pSelected] = 1;
FirstJoin[playerid] = 0;
TogglePlayerSpectating(playerid, true);
SetTimerEx("Reclassion", 50, false, "i", playerid);
PlayerSpawned[playerid] = 0;
SendClientMessage(playerid, COLOR_BLUELIGHT, "Thank you for choosing a class. Please now select a skin.");
}
else
{
PlayerSpawned[playerid] = 1;
}
if(Player[playerid][pAdminlevel] > 0 )
{
SpecOn[playerid] = 1;
}
if(specon == 1)
{
SpecOn[playerid] = 1;
}
else
{
if(Player[playerid][pAdminlevel] > 0 )
{
SpecOn[playerid] = 1;
}
else
{
SpecOn[playerid] = 0;
}
}
if(PlayerSpawned[playerid] == 1)
{
if(Player[playerid][pExp] == 0)
{
SendClientMessage(playerid, 0x0BEED4AA , "As a new player, you might find these commands useful:" );
SendClientMessage(playerid, 0xFF7300AA , " /help - /admins - /rules" );
}
}
if(Player[playerid][pAdminlevel] == 5)
{
LeaderText[playerid] = Create3DTextLabel("Leader Of Blue Team", 0x0BEED4AA, 30.0, 40.0, 50.0, 30, -1, 1);
Attach3DTextLabelToPlayer(LeaderText[playerid], playerid, 0.0, 0.0, 0.45);
}
else
{
Update3DTextLabelText(LeaderText[playerid], 0xFFFFFFFF, "");
}
if(SwatSkin[playerid] == 1)
{
if(Player[playerid][pSaveSkin] == 0)
{
SetPlayerSkin(playerid, oldskin);
SwatSkin[playerid] = 0;
}
}
else
{
SwatSkin[playerid] = 0;
}
if(Player[playerid][pTeam] == 1)
{
SetPlayerTeam(playerid, 1);
if(Player[playerid][pColor] == 0)
{
if(Stealthed[playerid] == 0)
{
SetPlayerColor(playerid, COLOR_BLUE);
}
}
if(Player[playerid][pSpawnOn] == 0)
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
}
SetPlayerFacingAngle(playerid, 0);
GivePlayerWeapon(playerid,24, 1000);
GivePlayerWeapon(playerid,25, 1000);
GivePlayerWeapon(playerid,29, 1000);
GivePlayerWeapon(playerid,30, 1000);
GivePlayerWeapon(playerid,33, 1000);
}
if(Player[playerid][pTeam] == 2)
{
SetPlayerTeam(playerid, 2);
if(Player[playerid][pColor] == 0)
{
if(Stealthed[playerid] == 0)
{
SetPlayerColor(playerid, COLOR_RED);

}
}
if(Player[playerid][pSpawnOn] == 0)
{
new Random = random(sizeof(RandomSpawns2));
SetPlayerPos(playerid, RandomSpawns2[Random][0], RandomSpawns2[Random][1], RandomSpawns2[Random][2]);
}
SetPlayerFacingAngle(playerid, 0);
GivePlayerWeapon(playerid,24, 1000);
GivePlayerWeapon(playerid,25, 1000);
GivePlayerWeapon(playerid,29, 1000);
GivePlayerWeapon(playerid,30, 1000);
GivePlayerWeapon(playerid,33, 1000);
}
if(Player[playerid][pSpylevel] > 0)
{
if(Player[playerid][pTeam] == 1)
{
SetPlayerTeam(playerid, 1);
if(Player[playerid][pSpawnOn] == 0)
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
}
}
if(Player[playerid][pTeam] == 2)
{
SetPlayerTeam(playerid, 2);
if(Player[playerid][pSpawnOn] == 0)
{
new Random = random(sizeof(RandomSpawns2));
SetPlayerPos(playerid, RandomSpawns2[Random][0], RandomSpawns2[Random][1], RandomSpawns2[Random][2]);
}
}
}
if(Player[playerid][pFbilevel] > 0 )
{
if(Player[playerid][pSpawnOn] == 0)
{
SetPlayerPos(playerid, 616.35, -609.21, 16.80);
}
SetPlayerTeam(playerid, 4);
if(Stealthed[playerid] == 0)
{
SetPlayerColor(playerid, 0x242424AA);
}
SetPlayerFacingAngle(playerid, 0);
}
if(Player[playerid][pSpylevel] == 1)
{
SendClientMessage(playerid, 0x0BEED4AA , "You are spy level 1 [Veteran Agent]");
GivePlayerWeapon(playerid,23, 150);
GivePlayerWeapon(playerid,29, 150);
GivePlayerWeapon(playerid,31, 150);
GivePlayerWeapon(playerid,34, 20);
}
if(Player[playerid][pSpylevel] == 2)
{
SendClientMessage(playerid, 0x0BEED4AA , "You are spy level 2 [Special Agent]");
GivePlayerWeapon(playerid,23, 250);
GivePlayerWeapon(playerid,29, 300);
GivePlayerWeapon(playerid,31, 300);
GivePlayerWeapon(playerid,34, 40);
}
if(Player[playerid][pSpylevel] == 3)
{
SendClientMessage(playerid, 0x0BEED4AA , "You are spy level 3 [Field Operative]");
GivePlayerWeapon(playerid,23, 350);
GivePlayerWeapon(playerid,29, 500);
GivePlayerWeapon(playerid,31, 500);
GivePlayerWeapon(playerid,34, 60);
}
if(Player[playerid][pSpylevel] == 4)
{
SendClientMessage(playerid, 0x0BEED4AA , "You are spy level 4 [Handler]");
GivePlayerWeapon(playerid,23, 450);
GivePlayerWeapon(playerid,29, 800);
GivePlayerWeapon(playerid,31, 800);
GivePlayerWeapon(playerid,34, 80);
}
if(Player[playerid][pSpylevel] == 5)
{
SendClientMessage(playerid, 0x0BEED4AA , "*You are spy level 5 [Superintendent Spy Master]");
GivePlayerWeapon(playerid,23, 550);
GivePlayerWeapon(playerid,29, 1000);
GivePlayerWeapon(playerid,31, 1000);
GivePlayerWeapon(playerid,34, 100);
}
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Special_Pilot_Blue", true))
{
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerSkin(playerid, 255);
PutPlayerInVehicle(playerid, BlueVehicle, 0);
Player[playerid][pTeam] = 1;
SetPlayerTeam(playerid, 1);
AttachObjectToVehicle(object1, BlueVehicle, 2.100000, 0.100000, -0.599999, 0.000000, 0.000000, 89.000000 );
AttachObjectToVehicle(object2, BlueVehicle, -2.200000, 0.000000, -0.600000, 0.000000, 0.000000, 91.000000 );
}
else if(!strcmp(npcname, "Special_Pilot_Red", true))
{
SetPlayerColor(playerid, COLOR_RED);
SetPlayerSkin(playerid, 255);
PutPlayerInVehicle(playerid, RedVehicle, 0);
Player[playerid][pTeam] = 2;
SetPlayerTeam(playerid, 2);
AttachObjectToVehicle(object3, RedVehicle, 2.100000, 0.100000, -0.599999, 0.000000, 0.000000, 89.000000 );
AttachObjectToVehicle(object4, RedVehicle, -2.200000, 0.000000, -0.600000, 0.000000, 0.000000, 91.000000 );
}
else if(!strcmp(npcname, "Special_Worker_T1", true))
{
SetPlayerColor(playerid, COLOR_YELLOW);
SetPlayerSkin(playerid, ;
PutPlayerInVehicle(playerid, Worker1Vehicle, 0);
Player[playerid][pColor] = 3;
Player[playerid][pTeam] = 0;
SetPlayerTeam(playerid, 3);
}
else if(!strcmp(npcname, "Special_Worker_T2", true))
{
SetPlayerColor(playerid, COLOR_YELLOW);
SetPlayerSkin(playerid, ;
PutPlayerInVehicle(playerid, Worker2Vehicle, 0);
Player[playerid][pColor] = 3;
Player[playerid][pTeam] = 0;
SetPlayerTeam(playerid, 3);
}
}
if(PlayerSpawned[playerid] == 1)
{
SendClientMessage(playerid, -1, "Spawning Please Wait...");
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(duelmode[playerid] == 1)
{
SendClientMessage(playerid, COLOR_BLUELIGHT, "Duelmode has been disactivated.");
duelmode[playerid] = 0;
}
if(Player[killerid][pScore] == 1)
{
SendClientMessage(killerid, COLOR_GREEN, "Achievement: {FFFFFF}First Blood{00FF00} | Make your first kill.");
SendClientMessage(killerid, COLOR_GREEN, "You get an extra $5.00 for this kill");
GivePlayerMoneyEx(killerid, 4);
Player[killerid][pCash] += 4;
}
new Achievement = randomEx(0, 20);
if(Achievement == 3)
{
SendClientMessage(killerid, COLOR_GREEN, "Achievement: {FFFFFF}Rounded kill{00FF00} | Kill with the last bullet in your clip.");
SendClientMessage(killerid, COLOR_GREEN, "You get an extra $2.00 for this kill");
GivePlayerMoneyEx(killerid, 1);
Player[killerid][pCash] += 1;
}
if(Achievement == 10)
{
SendClientMessage(killerid, COLOR_GREEN, "Achievement: {FFFFFF}Golden rounded{00FF00} | Kill bonus of round kill.");
SendClientMessage(killerid, COLOR_GREEN, "You get an extra $10.00 for this kill");
GivePlayerMoneyEx(killerid, 9);
Player[killerid][pCash] += 9;
}
SendDeathMessage(killerid, playerid, reason);
Player[killerid][pCash] ++;
Player[killerid][pScore] ++;
SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
GivePlayerMoneyEx(killerid, 1);
Dead[playerid] = 1;
if(gPlayerUsingLoopingAnim[playerid] == 1)
{
gPlayerUsingLoopingAnim[playerid] = 0;
}
if(IsOnePlayAnim[playerid] == 1)
{
IsOnePlayAnim[playerid] = 0;
}
if(BackOut[playerid] == 1)
{
BackOut[playerid] = 0;
}
InBike[playerid] = 0;
for(new i = 0; i <19 ; i++) TextDrawHideForPlayer(playerid, HealthBar[i]);
if(Spawning[playerid] == 1)
{
Spawningkilled[killerid] ++;
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)