Abend Ladies.
Kleine Frage:
Ich will in den Interior 1 einen Spieler setzen, der per SetPlayerCamera dann halt sich umgucken können soll.
Damit die normalen Spieler ihn nicht töten, habe ich ihn auf den Boden des Meeres gesetzt.
Hier setze ich ihn hin :
SetPlayerPosFindZ(playerid,2825.1636,577.2719,-0.6631);
SetPlayerCameraPos(playerid,0,0,100);
SetPlayerCameraLookAt(playerid,0,0,0);
SetPlayerInterior(playerid,0);
TogglePlayerControllable(playerid,1);
ClearAnimations(playerid);
SetTimerEx("comview_func",250,0,"i",playerid);
Das Problem, sobald diese comview_funktion aufgerufen wird,
kann man sich nichtmehr bewegen (ich schätzte, dass der deshalb die GetPlayerKeys nichtmehr schlucken will).
Das hier ist die Funktion:
public comview_func(playerid)
{
if(!IsPlayerConnected(playerid) || player[playerid][position] != 4) return 0;
new comkeys[3];
GetPlayerKeys(playerid,comkeys[0],comkeys[1],comkeys[2]);
if(comkeys[1] > 0) comview[player[playerid][team]-1][1] - 25;
if(comkeys[1] < 0) comview[player[playerid][team]-1][1] + 25;
if(comkeys[2] > 0) comview[player[playerid][team]-1][0] - 25;
if(comkeys[2] < 0) comview[player[playerid][team]-1][0] + 25;
SetPlayerCameraPos(playerid,float(comview[player[playerid][team]-1][0]),float(comview[player[playerid][team]-1][1]),100);
SetPlayerCameraLookAt(playerid,float(comview[player[playerid][team]-1][0]),float(comview[player[playerid][team]-1][1]),0);
if(comisbuilding[player[playerid][team]-1] == 1 && (combuilding[team-1][0] != comview[player[playerid][team]-1][0] || combuilding[team-1][1] != comview[player[playerid][team]-1][1]))
{
DestroyPlayerObject(playerid,combuildid[player[playerid][team]-1]);
combuilding[team-1][0] = comview[player[playerid][team]-1][0];
combuilding[team-1][1] = comview[player[playerid][team]-1][1];
SetPlayerPosFindZ(calcnpc[player[playerid][team]-1],float(combuilding[player[playerid][team]-1][0]),float(combuilding[player[playerid][team]-1][1]),100);
SetTimerEx("calcbuild",350,0,"iii",playerid,player[playerid][team],combuildinginprogress[player[playerid][team]-1]);
}
if((comkeys[0] == KEY_JUMP || comkeys[0] & KEY_JUMP) && comisbuilding[player[playerid][team]-1] == 0)
{
if(mainx[player[playerid][team]-1] == 0 || mainx[player[playerid][team]-1] == float(0))
{
comisbuilding[player[playerid][team]-1] = 1,combuildinginprogress[player[playerid][team]-1] = 3873;
combuilding[player[playerid][team]][0] = comview[player[playerid][team]][0];
combuilding[player[playerid][team]][1] = comview[player[playerid][team]][1];
SetPlayerPosFindZ(calcnpc[player[playerid][team]-1],combuilding[player[playerid][team]-1][0],combuilding[player[playerid][team]-1][1],100);
SetTimerEx("calcbuild",500,0,"iii",playerid,player[playerid][team],3873);
}
ShowPlayerDialog(playerid,555,DIALOG_STYLE_LIST,"Build Menu","Clone Sub-Centre\t3500$\nOil-well derrick\t1000$\nArmory\t8000$\nHunter factory\t15000$\nTank factory\t15000$\nClone Research Centre\t15000$\nSAM Site\t8000$","Build","Abort");
}
if((comkeys[0] == KEY_JUMP || comkeys[0] & KEY_JUMP) && comisbuilding[player[playerid][team]-1] == 1)
{
if(combuildinginprogress[player[playerid][team]-1] == 3873)
{
new found_build = 0;
for(new srch = 0;srch<=sub_number[player[playerid][team]-1];srch++)
{
if(combuilding[player[playerid][team]-1][0] +20 < subpos[player[playerid][team]-1][srch][0] && combuilding[player[playerid][team]-1][0] -20 > subpos[player[playerid][team]-1][srch][0] && combuilding[player[playerid][team]-1][1] +20 < subpos[player[playerid][team]-1][srch][1]
&& combuilding[player[playerid][team]-1][1] -20 > subpos[player[playerid][team]-1][srch][1] && combuilding[player[playerid][team]-1][2] +20 < subpos[player[playerid][team]-1][srch][2] && combuilding[player[playerid][team]-1][2] -20 > subpos[player[playerid][team]-1][srch][2])
{
found_build = 0;
break;
}
}
if(found_build == 0) return GameTextForPlayer(playerid,"You can just build structures close to a Clone Sub-Centre",2000,1);
comisbuilding[player[playerid][team]-1] = 0,combuildinginprogress[player[playerid][team]-1] = 0;
DestroyPlayerObject(playerid,combuildid[player[playerid][team]-1]);
building[clone][player[playerid][team]-1][id] = CreateObject(3873,combuilding[player[playerid][team]-1][0],combuilding[player[playerid][team]-1][1],combuilding[player[playerid][team]-1][2],0,0,0);
building[clone][player[playerid][team]-1][health] = 50000,building[clone][player[playerid][team]-1][placex] = combuilding[player[playerid][team]-1][0],building[clone][player[playerid][team]-1][placey] = combuilding[player[playerid][team]-1][1],building[clone][player[playerid][team]-1][placez] = combuilding[player[playerid][team]-1][2];
}
}
SetTimerEx("comview_func",250,0,"i",playerid);
return 1;
}
Hoffe auf heutige Hilfe (Anapher ftw ),
Trooper