[HELP] SetSpawnInfo without loosing weapons
#1

hello, I just write a gamemode. I have done creating hospitalspawns before. (of course assisted)

I use setplayerpos before
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(dead[playerid]==true)
    {
    new i = gClosestHospital[playerid];
    SetPlayerPos(playerid, HospitalSpawns[i][0], HospitalSpawns[i][1], HospitalSpawns[i][2]);
    SetPlayerFacingAngle(playerid, HospitalSpawns[i][3]);
    SetCameraBehindPlayer(playerid);
    }

    if(dead[playerid]==false)
    {
    SetPlayerPos(playerid, 1714.9219,-1948.8318,14.1172);
    SetPlayerFacingAngle(playerid, 357.5184);
    SetCameraBehindPlayer(playerid);
    return 1;
    }
    return 0;
}


public OnPlayerDeath(playerid, killerid, reason)
{
    GameTextForPlayer(playerid, "Wasted", 5000, 2);
    SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    dead[playerid] = true;
    new Float:dist = FLOAT_INFINITY;
    for (new i = 0; i < sizeof(HospitalSpawns); i++)
    {
        gClosestHospitalDist[playerid] = GetPlayerDistanceFromPoint(playerid, HospitalSpawns[i][0], HospitalSpawns[i][1], HospitalSpawns[i][2]);
        if (gClosestHospitalDist[playerid] < dist)
        {
            dist = gClosestHospitalDist[playerid];
            gClosestHospital[playerid] = i;
        }
    }
    return 1;
}
Using SetPlayerPos in Onplayerspawn callback, causing player spawns to char selection location (I use Avery Construction at blueberry) and Afterwards move to hospital location. so I change to SetSpawnInfo

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(dead[playerid]==false)
    {
    SetPlayerPos(playerid, 1714.9219,-1948.8318,14.1172);
    SetPlayerFacingAngle(playerid, 357.5184);
    SetCameraBehindPlayer(playerid);
    }
    else
    {
    dead[playerid]=true;
    }
    return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
    GameTextForPlayer(playerid, "Wasted", 5000, 2);
    SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    dead[playerid] = true;
    new Float:dist = FLOAT_INFINITY;
    for (new i = 0; i < sizeof(HospitalSpawns); i++)
    {
        gClosestHospitalDist[playerid] = GetPlayerDistanceFromPoint(playerid, HospitalSpawns[i][0], HospitalSpawns[i][1], HospitalSpawns[i][2]);
        if (gClosestHospitalDist[playerid] < dist)
        {
            dist = gClosestHospitalDist[playerid];
            gClosestHospital[playerid] = i;
        }
    }
    new playerskin = GetPlayerSkin(playerid);
    new i = gClosestHospital[playerid];
    SetSpawnInfo(playerid, 0, playerskin, HospitalSpawns[i][0], HospitalSpawns[i][1], HospitalSpawns[i][2], HospitalSpawns[i][3], 0, 0, 0, 0, 0, 0);
    return 1;
}
no idea with weapon section so I set to 0. how can I setSpawnInfo without loosing weapons? I'd like to use if player in a statement, the player will not loose their weapons after death
Reply


Messages In This Thread
[HELP] SetSpawnInfo without loosing weapons - by GianYagami - 15.01.2015, 11:40
Re: [HELP] SetSpawnInfo without loosing weapons - by ATGOggy - 15.01.2015, 12:00
Re: [HELP] SetSpawnInfo without loosing weapons - by GianYagami - 24.09.2017, 08:05

Forum Jump:


Users browsing this thread: 1 Guest(s)