PDA

Просмотр полной версии : [Вопрос] Ошибка в OnPlayerSpawn



MarioORG
02.12.2014, 01:36
Помогите! Если у игрока есть дом, он спавнится в деревне (баг), если нету - все ок.

public OnPlayerSpawn(playerid)
{
StopAudioStreamForPlayer(playerid);
SetPlayerSkin(playerid,Player[playerid][pSkin]);
if(Player[playerid][pHouse] >= 1){
for(new h=1;h<=m_h;h++)
{
if(strcmp(House[h][hOwner],PlayerName(playerid),true)!= 0){
SetPlayerPos(playerid,HInts[House[h][hInterior]][hiX],HInts[House[h][hInterior]][hiY],HInts[House[h][hInterior]][hiZ]);
SetPlayerInterior(playerid,HInts[House[h][hInterior]][hiInt]);
SetPlayerVirtualWorld(playerid,House[h][hVirtWorld]);}
}
}else{SetPlayerPos(playerid,324.3589,-1516.6516,36.0325); SetPlayerVirtualWorld(playerid,0);SetPlayerInterio r(playerid,0);}
return 1;
}

Mr.DeViLsS
02.12.2014, 06:19
зачем тут цикл?


public OnPlayerSpawn(playerid)
{
StopAudioStreamForPlayer(playerid);
SetPlayerSkin(playerid,Player[playerid][pSkin]);
if(Player[playerid][pHouse] >= 1) {
SetPlayerPos(playerid,HInts[House[Player[playerid][pHouse]][hInterior]][hiX],HInts[House[Player[playerid][pHouse]][hInterior]][hiY],HInts[House[Player[playerid][pHouse]][hInterior]][hiZ]);
SetPlayerInterior(playerid,HInts[House[Player[playerid][pHouse]][hInterior]][hiInt]);
SetPlayerVirtualWorld(playerid,House[Player[playerid][pHouse]][hVirtWorld]);
return 1;
}
else {
SetPlayerPos(playerid,324.3589,-1516.6516,36.0325); SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
return 1;
}
return 1;
}