[REP WHO HELPS] Problem with OnPlayerDeath
#1

So my next problem is onplayerdeath. I found about it when some players were showing me that they are spawning at 0.0 , 0.0 , 0.0 coordinates (farm).

I am using if(killerid != INVALID_PLAYER_ID) condition in places where i use killerid.
I don't have any errors , i installed crashdetect on linux but no errors since i am using if(killerid != INVALID_PLAYER_ID) condition.

Here is an example:

I am going to fight with a player in paintball . All is ok for now. If i relog i get spawned at 0.0, 0.0, 0.0 (farm) which is not ok. What could be? Usually players are spawned in the right position , but if someone goes and fight to paintball ( i say this because in this place i use pV[killerid][pScore]++ then a player logs in , or rejoins server , he is spawned to 0.0 , 0.0, 0.0 coordinates (Farm).

How to fix this? What it could be ?

Thanks!
Reply
#2

Its because it doesnt set the interior when you log in which makes it spawn at that farm.
Reply
#3

Quote:
Originally Posted by Hybris
Посмотреть сообщение
Its because it doesnt set the interior when you log in which makes it spawn at that farm.
If you read my first post at this topic you will se that spawning at farm isn't always , it's just after players goes and fights at paintball .

I am setting the interiors to 0 if players isn't in a faction.
Reply
#4

I think it would help if you could show us the code of the player entering the paintball fight and spawn when the player logins.
Reply
#5

Quote:
Originally Posted by Nixtren
Посмотреть сообщение
I think it would help if you could show us the code of the player entering the paintball fight and spawn when the player logins.
Here it is my all OnPlayerSpawn.

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid, 99);

    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"GANGS");
    PreloadAnimLib(playerid,"PED");
    PreloadAnimLib(playerid,"FAT");
    PreloadAnimLib(playerid,"GRAFFITI");

    SetPlayerToTeamColor(playerid);

    SetPlayerSkin(playerid, playerVariables[playerid][pPlayerSkin]);

    ResetPlayerWeapons(playerid);

    StopAudioStreamForPlayer(playerid);

    TogglePlayerSpectating(playerid, 0);

    TogglePlayerControllable(playerid, true);

    SetCameraBehindPlayer(playerid);

    if(pbStarted == 1)
    {
        if(PEntered[playerid] == 1)
        {
            if(pbMAP == 1)
            {
                new rand;
                rand = random(sizeof(PaintballSpawns1));
                SetPlayerPos(playerid, PaintballSpawns1[rand][0], PaintballSpawns1[rand][1], PaintballSpawns1[rand][2]);
           
                SetPlayerVirtualWorld(playerid, 10);
                SetPlayerInterior(playerid, 10);
                SetPlayerSkin(playerid, 293);
               
                GivePlayerWeapon(playerid, pbGUN, 10000);

                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 0);
            }
            else if(pbMAP == 2)
            {
                new rand;
                rand = random(sizeof(PaintballSpawns1));
                SetPlayerPos(playerid, PaintballSpawns2[rand][0], PaintballSpawns2[rand][1], PaintballSpawns2[rand][2]);

                SetPlayerVirtualWorld(playerid, 10);
                SetPlayerInterior(playerid, 0);
                SetPlayerSkin(playerid, 293);

                GivePlayerWeapon(playerid, pbGUN, 10000);

                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 0);
            }
        }
        return 1;
    }
   
    if(playerVariables[playerid][pSpawnSet] == 0)
    {
        if(playerVariables[playerid][pGroup] == 0)
        {
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerPos(playerid, 2756.4507,-1182.4026,69.3996);
            SetPlayerInterior(playerid, 0);
        }
        else
        {
            new group;
            group = playerVariables[playerid][pGroup];
            SetPlayerPos(playerid, groupVariables[group][gGroupInteriorPos][0], groupVariables[group][gGroupInteriorPos][1], groupVariables[group][gGroupInteriorPos][2]+1);
            SetPlayerInterior(playerid, groupVariables[group][gGroupHQInteriorID]);
            SetPlayerVirtualWorld(playerid, GROUP_VIRTUAL_WORLD+group);
        }
    }
    else if(playerVariables[playerid][pSpawnSet] == 1)
    {
        new houseID = getPlayerHouseID(playerid);
        new houserented = playerVariables[playerid][pHouseRented];
       
        if(houseID >= 1)
        {
            SetPlayerInterior(playerid, houseVariables[houseID][hHouseInteriorID]);
            SetPlayerVirtualWorld(playerid, HOUSE_VIRTUAL_WORLD+houseID);
            SetPlayerPos(playerid, houseVariables[houseID][hHouseInteriorPos][0], houseVariables[houseID][hHouseInteriorPos][1], houseVariables[houseID][hHouseInteriorPos][2]);

            InHouse[playerid] = houseID;
        }
        else
        {
            if(houserented >= 1)
            {
                SetPlayerInterior(playerid, houseVariables[houserented][hHouseInteriorID]);
                SetPlayerVirtualWorld(playerid, HOUSE_VIRTUAL_WORLD+houserented);
                SetPlayerPos(playerid, houseVariables[houserented][hHouseInteriorPos][0], houseVariables[houserented][hHouseInteriorPos][1], houseVariables[houserented][hHouseInteriorPos][2]);

                InHouse[playerid] = houserented;
            }
        }
    }
    return 1;
}
Any new answers? Thanks!
Reply
#6

Coords 0,0,0 (the farm) is the middle of the map,players can spawn there cause of slow internet,high ping,because i always spawn there and if he request a class without AddPlayerClass
Also i think you must show us the random paintball spawns 1 and 2
Reply
#7

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Coords 0,0,0 (the farm) is the middle of the map,players can spawn there cause of slow internet,high ping,because i always spawn there and if he request a class without AddPlayerClass
Also i think you must show us the random paintball spawns 1 and 2
Paintballspawns are correctly , i tested all of them . My problem is at OnPlayerDeath , can someone explain me or give me an example of how to use it ? With killerid and all of this ? Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)