[Help] - Spawn at Lv - + Rep
#1

Hello, i have weird bug, when player register to the server, he spawns at LV (the stairways).

here's OnPlayerSpawn:

pawn Код:
public OnPlayerSpawn(playerid)
{ new string[256];
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid,0);
    WantedMissionKills[playerid] = 0;  // Wanted Mission System
    WantedMission[playerid] = 0;       // Wanted Mission System
    SetPlayerWantedLevel(playerid, 0); // Wanted Mission System
    if(IsDead[playerid] == 1 && InCall[playerid] == 1 && Tallking[playerid] == 1) IsDead[playerid] = 0; // Phone System
    RemovePlayerAttachedObject(playerid, Helmet_For_Bike); // Helmet For MotorBikes
    if(dini_Int(PlayerFile(playerid),"HaveSkin") == 1) SetPlayerSkin(playerid,dini_Int(PlayerFile(playerid),"SkinID"));
    if(dini_Int(PlayerFile(playerid),"Tuki") == 1) SetPlayerAttachedObject(playerid,3,19078,1,0.320722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
    if(dini_Int(PlayerFile(playerid),"InClan") == 1)
{
    format(string,sizeof(string),"DeathMatch/Server/Clans/%s.ini",dini_Get(PlayerFile(playerid),"PlayerClan"));
    SetPlayerColor(playerid,rgba2hex(dini_Int(string,"R"),dini_Int(string,"G"),dini_Int(string,"B"),255));
}
    else return SetPlayerColor(playerid,random(PlayerColors[playerid])); // RandomColor
    SetTimerEx("SetColor",400,false,"d",playerid); // Gang System
// [ Weapons System ] ----------------------------------------------------------
    if(GetBaseballBat(playerid))     GivePlayerWeapon(playerid,5, 1);
    if(GetGolfClub(playerid))        GivePlayerWeapon(playerid,2,1);
    if(GetKnife(playerid))           GivePlayerWeapon(playerid,4,1);
    if(GetKatana(playerid))          GivePlayerWeapon(playerid,8,1);
    if(GetChainsaw(playerid))        GivePlayerWeapon(playerid,9,1);
    if(GetPistol(playerid))          GivePlayerWeapon(playerid,22,dini_Int(PlayerFile(playerid),"Pistol"));
    if(GetSilencedPistol(playerid))  GivePlayerWeapon(playerid,23,dini_Int(PlayerFile(playerid),"Silenced Pistol"));
    if(GetDesertEagle(playerid))     GivePlayerWeapon(playerid,24,dini_Int(PlayerFile(playerid),"Desert Eagle"));
    if(GetMP5(playerid))             GivePlayerWeapon(playerid,29,dini_Int(PlayerFile(playerid),"MP5"));
    if(GetShotgun(playerid))         GivePlayerWeapon(playerid,25,dini_Int(PlayerFile(playerid),"Shotgun"));
    if(GetCombatShotgun(playerid))   GivePlayerWeapon(playerid,27,dini_Int(PlayerFile(playerid),"Combat Shotgun"));
    if(GetAK47(playerid))            GivePlayerWeapon(playerid,30,dini_Int(PlayerFile(playerid),"AK47"));
    if(GetM4(playerid))              GivePlayerWeapon(playerid,31,dini_Int(PlayerFile(playerid),"M4"));
    if(GetRifle(playerid))           GivePlayerWeapon(playerid,33,dini_Int(PlayerFile(playerid),"Rifle"));
    if(GetSniperRifle(playerid))     GivePlayerWeapon(playerid,34,dini_Int(PlayerFile(playerid),"Sniper Rifle"));
    if(GetTec9(playerid))            GivePlayerWeapon(playerid,32,dini_Int(PlayerFile(playerid),"Tec9"));
    if(GetMicroUzi(playerid))        GivePlayerWeapon(playerid,28,dini_Int(PlayerFile(playerid),"Micro Uzi"));
    if(GetSawnOffShotgun(playerid))  GivePlayerWeapon(playerid,26,dini_Int(PlayerFile(playerid),"Sawn Off Shotgun"));
    if(GetArmour(playerid))          SetPlayerArmour(playerid,100);
// [ Dm Zone ] -----------------------------------------------------------------
if(IsPlayerInDM[playerid] == 1)
{
    RemovePlayerAttachedObject(playerid, Helmet_For_Bike); // Helmet For MotorBikes
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 24, 1000); // Desert Eagle
    GivePlayerWeapon(playerid, 31, 1000); // M4
    GivePlayerWeapon(playerid, 27, 1000); // Combat ShotGun
    new rand = random(sizeof(DmRandomSpawns));
    SetPlayerPos(playerid, DmRandomSpawns[rand][0], DmRandomSpawns[rand][1], DmRandomSpawns[rand][2]);
    SetPlayerFacingAngle(playerid,DmRandomSpawns[rand][3]);
    SetPlayerVirtualWorld(playerid, DmVirtualWorld);
    SetPlayerInterior(playerid, 0);
    SetCameraBehindPlayer(playerid);
    SetPlayerArmour(playerid, 0);
    TextDrawShowForPlayer(playerid,txtTimeDisp); // RealTime
    gettime(mhour,mminute); // RealTime
    AntiDeAMX(); // AntiDeAMX
    IsAfk[playerid] = 0; // Afk System
}
    else if(IsPlayerInSawn[playerid] == 1)
{
    RemovePlayerAttachedObject(playerid, Helmet_For_Bike); // Helmet For MotorBikes
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,22,10); // Pistol
    GivePlayerWeapon(playerid,28,10); // Uzi
    GivePlayerWeapon(playerid,26,1000); // Sawn
    new rand = random(sizeof(SawnRandomSpawns));
    SetPlayerPos(playerid, SawnRandomSpawns[rand][0], SawnRandomSpawns[rand][1], SawnRandomSpawns[rand][2]);
    SetPlayerFacingAngle(playerid,SawnRandomSpawns[rand][3]);
    SetPlayerVirtualWorld(playerid, SawnVirtualWorld);
    SetPlayerInterior(playerid, 0);
    SetCameraBehindPlayer(playerid);
    SetPlayerArmour(playerid, 0);
    TextDrawShowForPlayer(playerid,txtTimeDisp); // RealTime
    gettime(mhour,mminute); // RealTime
    AntiDeAMX(); // AntiDeAMX
    IsAfk[playerid] = 0; // Afk System
}
    else if(IsPlayerInDM[playerid] == 0 && IsPlayerInSawn[playerid] == 0)
{
    RemovePlayerAttachedObject(playerid, Helmet_For_Bike); // Helmet For MotorBikes
    new rand = random(sizeof(PlayerRandomSpawns));
    SetPlayerPos(playerid, PlayerRandomSpawns[rand][0], PlayerRandomSpawns[rand][1], PlayerRandomSpawns[rand][2]);
    SetPlayerFacingAngle(playerid,PlayerRandomSpawns[rand][3]);
    TextDrawShowForPlayer(playerid,txtTimeDisp); // RealTime
    gettime(mhour,mminute); // RealTime
    AntiDeAMX(); // AntiDeAMX
    IsAfk[playerid] = 0; // Afk System
    SetCameraBehindPlayer(playerid);
    Killing[playerid] = 0; // Dm / Sawn Zone Kill In Row Price
}
return 1;
}
Reply
#2

That's because you don't set his position on spawn.. and the LV stairway is probably in the format of

pawn Код:
AddPlayerClass(skinid, x, y, z .... etc);
Reply
#3

Quote:
Originally Posted by vyper
Посмотреть сообщение
That's because you don't set his position on spawn.. and the LV stairway is probably in the format of

pawn Код:
AddPlayerClass(skinid, x, y, z .... etc);
oh, you right! i tried to fix this problem more than couple of days!
but now i got new problem, every time i spawn, i got the spawn when i spawned at the beginning
Reply
#4

jumP
Reply
#5

What do you mean spawned at the beginning?
Reply
#6

Quote:
Originally Posted by Reklez
Посмотреть сообщение
What do you mean spawned at the beginning?
I use random spawns. so i did on: AddPlayerClass:
pawn Код:
new rand = random(sizeof(PlayerRandomSpawns));
for(new i; i<300; i++) AddPlayerClass(i,PlayerRandomSpawns[rand][0], PlayerRandomSpawns[rand][1], PlayerRandomSpawns[rand][2], PlayerRandomSpawns[rand][3],-1,-1,-1,-1,-1,-1);
but after i spawn, i can spawn only on the same spawn when i spawned first..
Reply
#7

Try replacing AddPlayerClass with SetPlayerPos
Reply
#8

Hmm you need to have different places ..so it spawn @ Random
Reply
#9

Quote:
Originally Posted by RoleplayEditor
Посмотреть сообщение
Hmm you need to have different places ..so it spawn @ Random
i already have -_-
Reply
#10

Change AddPlayerClass with

pawn Код:
SetPlayerPos(playerid, X, Y, Z); //replace X/Y/Z with your random spawn position coordinates
use SetPlayerInterior also incase some problems
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)