12.11.2016, 11:00
Hi guys!
I made code for signing up. Problem is in player's camera(SetPlayerCamera, and SetPlayerCameraLookAt). Look below for code.
Problem is in switch
Server creates an actor, but it doesn't set player's camera.
Also, in OnPlayerRequestClass I use TogglePlayerSpectating(playerid, true);.
Camera stays in village.
I made code for signing up. Problem is in player's camera(SetPlayerCamera, and SetPlayerCameraLookAt). Look below for code.
Код:
stock _HRP_Registracija(_playerid) { new _kamera = random(10); _HRP_KreirajRegTDove(_playerid); SetPlayerVirtualWorld(_playerid, _playerid + 1); // POSTAVLJANJE POSTAVKI LIKA Bit1_Set(_HRP_kSpol, _playerid, random(2)); _HRP_kGodine{_playerid} = _HRP_NASUMICE(_HRP_MIN_GODINE, _HRP_MAX_GODINE); Bit2_Set(_HRP_kRasa, _playerid, random(4)); Bit1_Set(_HRP_kMailNotf, _playerid, 1); Bit1_Set(_HRP_kRuka, _playerid, 1); Bit1_Set(_HRP_kZastita, _playerid, 0); if(Bit1_Get(_HRP_kSpol, _playerid) == 0) { switch(Bit2_Get(_HRP_kRasa, _playerid)) { case 0: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_MSkin_B)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_MSkin_B[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Bijelac"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 632.00, 10.00); } case 1: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_MSkin_C)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_MSkin_C[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Crnac"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 622.00, 10.00); } case 2: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_MSkin_H)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_MSkin_H[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Hispanac"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 642.00, 10.00); } case 3: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_MSkin_A)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_MSkin_A[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Azijac"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 626.00, 10.00); } } if(15 <= _HRP_kGodine{_playerid} <= 40) _HRP_kVisina{_playerid} = _HRP_NASUMICE(172, 200); else _HRP_kVisina{_playerid} = _HRP_NASUMICE(172, 185); if(15 <= _HRP_kGodine{_playerid} <= 20) { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(27, 35); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(15, 25); _HRP_kMSala{_playerid} = _HRP_NASUMICE(15, 23); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(3500, 4000)); } else if(20 < _HRP_kGodine{_playerid} <= 45) { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(30, 35); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(20, 28); _HRP_kMSala{_playerid} = _HRP_NASUMICE(20, 28); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(3000, 3850)); } else { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(32, 40); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(15, 20); _HRP_kMSala{_playerid} = _HRP_NASUMICE(15, 20); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(2500, 3250)); } Bit4_Set(_HRP_kUdarac, _playerid, _HRP_NASUMICE(7, 12)); } else { switch(Bit2_Get(_HRP_kRasa, _playerid)) { case 0: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_ZSkin_B)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_ZSkin_B[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Bijelkinja"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 650.00, 10.00); } case 1: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_ZSkin_C)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_ZSkin_C[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Crnkinja"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 640.00, 10.00); } case 2: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_ZSkin_H)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_ZSkin_H[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Hispanka"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 642.00, 10.00); } case 3: { _HRP_SkinSlot{_playerid} = random(sizeof(_HRP_ZSkin_A)); Bit16_Set(_HRP_kIzgled, _playerid, _HRP_ZSkin_A[_HRP_SkinSlot{_playerid}]); PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][12], "Azijanka"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][12], 641.00, 10.00); } } if(15 <= _HRP_kGodine{_playerid} <= 40) _HRP_kVisina{_playerid} = _HRP_NASUMICE(165, 185); else _HRP_kVisina{_playerid} = _HRP_NASUMICE(160, 175); if(15 <= _HRP_kGodine{_playerid} <= 20) { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(10, 17); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(10, 20); _HRP_kMSala{_playerid} = _HRP_NASUMICE(18, 25); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(3000, 3500)); } else if(20 < _HRP_kGodine{_playerid} <= 40) { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(12, 18); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(15, 23); _HRP_kMSala{_playerid} = _HRP_NASUMICE(20, 28); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(2450, 3100)); } else { _HRP_kOMasa{_playerid} = _HRP_NASUMICE(26, 35); _HRP_kMMasa{_playerid} = _HRP_NASUMICE(10, 20); _HRP_kMSala{_playerid} = _HRP_NASUMICE(20, 29); Bit16_Set(_HRP_kZeludac, _playerid, _HRP_NASUMICE(2200, 2900)); } Bit4_Set(_HRP_kUdarac, _playerid, _HRP_NASUMICE(5, 8)); } Bit4_Set(_HRP_kRast, _playerid, _HRP_NASUMICE(5, 10)); if(15 <= _HRP_kGodine{_playerid} <= 30) { _HRP_kMetabolizam{_playerid} = _HRP_NASUMICE(30, 50); _HRP_kH2O{_playerid} = _HRP_NASUMICE(50, 75); _HRP_kOpijanje{_playerid} = _HRP_NASUMICE(5, 75); _HRP_kDrogiranje{_playerid} = _HRP_NASUMICE(10, 100); } else if(30 < _HRP_kGodine{_playerid} <= 50) { _HRP_kMetabolizam{_playerid} = _HRP_NASUMICE(25, 45); _HRP_kH2O{_playerid} = _HRP_NASUMICE(40, 60); _HRP_kOpijanje{_playerid} = _HRP_NASUMICE(5, 50); _HRP_kDrogiranje{_playerid} = _HRP_NASUMICE(10, 70); } else { _HRP_kMetabolizam{_playerid} = _HRP_NASUMICE(20, 40); _HRP_kH2O{_playerid} = _HRP_NASUMICE(48, 60); _HRP_kOpijanje{_playerid} = _HRP_NASUMICE(5, 85); _HRP_kDrogiranje{_playerid} = _HRP_NASUMICE(10, 90); } // PODEЉAVANJE KAMERE I UVODNA SCENA switch(_kamera) { case 0: // NA KROVU L.A. ARENE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2669.6633, -1751.8671, 36.5852, 310.00); SetPlayerCameraPos(_playerid, 2671.5752, -1753.5016, 42.3801); SetPlayerCameraLookAt(_playerid, 2670.6785, -1753.0627, 42.3901); } case 1: // ZGRADA PORED BANKE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1405.7518, -1472.6769, 125.3672, 310.00); SetPlayerCameraPos(_playerid, 1408.6704, -1474.4362, 129.6559); SetPlayerCameraLookAt(_playerid, 1407.8267, -1473.9021, 129.6908); } case 2: // NA VRHU ZGRADE U RODEO KVARTU { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 589.8210, -1481.6154, 80.1563, 310.00); SetPlayerCameraPos(_playerid, 592.7121, -1483.4023, 84.7762); SetPlayerCameraLookAt(_playerid, 591.8746, -1482.8580, 84.7512); } case 3: // NA VRHU KONSTRUKCIJE PORED SKATE PARKA { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1893.5349, -1324.8877, 49.4088, 310.00); SetPlayerCameraPos(_playerid, 1896.2023, -1326.8127, 55.2975); SetPlayerCameraLookAt(_playerid, 1896.0055, -1325.8336, 55.1725); } case 4: // KROV PIZZA STACKA { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2112.9502, -1790.4541, 22.2188, 310.00); SetPlayerCameraPos(_playerid, 2115.1523, -1792.3582, 26.9074); SetPlayerCameraLookAt(_playerid, 2114.3379, -1791.7805, 27.0725); } case 5: // KOЉARKAЉKO IGRALIЉTE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2322.3950, -1541.8126, 25.3438, 310.00); SetPlayerCameraPos(_playerid, 2324.8535, -1543.7720, 31.6199); SetPlayerCameraLookAt(_playerid, 2324.0281, -1543.2109, 31.6699); } case 6: // NADVOЋNJAK { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1622.5574, -1111.1586, 61.0234, 310.00); SetPlayerCameraPos(_playerid, 1624.9285, -1113.1091, 66.3038); SetPlayerCameraLookAt(_playerid, 1624.0940, -1112.5596, 66.3838); } case 7: // GYM NA PLAЋI { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 666.8121, -1871.7465, 5.4609, 310.00); SetPlayerCameraPos(_playerid, 669.2590, -1873.7061, 11.6934); SetPlayerCameraLookAt(_playerid, 668.6052, -1872.9509, 11.6684); } case 8: // FONTANA NA GLAVNOM TRGU { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1490.5436, -1645.7990, 15.0395, 310.00); SetPlayerCameraPos(_playerid, 1492.6007, -1647.6116, 20.4032); SetPlayerCameraLookAt(_playerid, 1492.1890, -1646.7018, 20.5832); } case 9: // POGLED NA HOLLYWOOD NATPIS { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1471.2583, -1008.4384, 61.1703, 310.00); SetPlayerCameraPos(_playerid, 1473.7114, -1010.3983, 68.0122); SetPlayerCameraLookAt(_playerid, 1472.8909, -1009.8300, 68.2072); } } // PODEЉAVANJE TEXTDRAWOVA ZA IN CHARACTER DIO REGISTRACIJE PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][2], _HRP_Ime(_playerid)); va_PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][6], "%d", _HRP_kGodine{_playerid}); if(Bit1_Get(_HRP_kSpol, _playerid) == 0) { PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][4], "Musko"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][4], 623.00, 10.00); } else { PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][4], "Zensko"); PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][4], 629.00, 10.00); } if(10 <= Bit16_Get(_HRP_kIzgled, _playerid) <= 99) PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][8], 10.000000, 20.000000); else if(1 <= Bit16_Get(_HRP_kIzgled, _playerid) <= 9) PlayerTextDrawTextSize(_playerid, _HRP_TD_Reg_IC[_playerid][8], 10.000000, 13.000000); va_PlayerTextDrawSetString(_playerid, _HRP_TD_Reg_IC[_playerid][8], "%d", Bit16_Get(_HRP_kIzgled, _playerid)); SetActorVirtualWorld(_HRP_RegModel[_playerid], _playerid + 1); SetTimerEx("_HRP_RegKamera", 3000, 0, "ii", _playerid, _kamera); _HRP_Pokazi_RegUvod(_playerid); return (true); }
Код:
switch(_kamera) { case 0: // NA KROVU L.A. ARENE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2669.6633, -1751.8671, 36.5852, 310.00); SetPlayerCameraPos(_playerid, 2671.5752, -1753.5016, 42.3801); SetPlayerCameraLookAt(_playerid, 2670.6785, -1753.0627, 42.3901); } case 1: // ZGRADA PORED BANKE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1405.7518, -1472.6769, 125.3672, 310.00); SetPlayerCameraPos(_playerid, 1408.6704, -1474.4362, 129.6559); SetPlayerCameraLookAt(_playerid, 1407.8267, -1473.9021, 129.6908); } case 2: // NA VRHU ZGRADE U RODEO KVARTU { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 589.8210, -1481.6154, 80.1563, 310.00); SetPlayerCameraPos(_playerid, 592.7121, -1483.4023, 84.7762); SetPlayerCameraLookAt(_playerid, 591.8746, -1482.8580, 84.7512); } case 3: // NA VRHU KONSTRUKCIJE PORED SKATE PARKA { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1893.5349, -1324.8877, 49.4088, 310.00); SetPlayerCameraPos(_playerid, 1896.2023, -1326.8127, 55.2975); SetPlayerCameraLookAt(_playerid, 1896.0055, -1325.8336, 55.1725); } case 4: // KROV PIZZA STACKA { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2112.9502, -1790.4541, 22.2188, 310.00); SetPlayerCameraPos(_playerid, 2115.1523, -1792.3582, 26.9074); SetPlayerCameraLookAt(_playerid, 2114.3379, -1791.7805, 27.0725); } case 5: // KOЉARKAЉKO IGRALIЉTE { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 2322.3950, -1541.8126, 25.3438, 310.00); SetPlayerCameraPos(_playerid, 2324.8535, -1543.7720, 31.6199); SetPlayerCameraLookAt(_playerid, 2324.0281, -1543.2109, 31.6699); } case 6: // NADVOЋNJAK { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1622.5574, -1111.1586, 61.0234, 310.00); SetPlayerCameraPos(_playerid, 1624.9285, -1113.1091, 66.3038); SetPlayerCameraLookAt(_playerid, 1624.0940, -1112.5596, 66.3838); } case 7: // GYM NA PLAЋI { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 666.8121, -1871.7465, 5.4609, 310.00); SetPlayerCameraPos(_playerid, 669.2590, -1873.7061, 11.6934); SetPlayerCameraLookAt(_playerid, 668.6052, -1872.9509, 11.6684); } case 8: // FONTANA NA GLAVNOM TRGU { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1490.5436, -1645.7990, 15.0395, 310.00); SetPlayerCameraPos(_playerid, 1492.6007, -1647.6116, 20.4032); SetPlayerCameraLookAt(_playerid, 1492.1890, -1646.7018, 20.5832); } case 9: // POGLED NA HOLLYWOOD NATPIS { _HRP_RegModel[_playerid] = CreateActor(Bit16_Get(_HRP_kIzgled, _playerid), 1471.2583, -1008.4384, 61.1703, 310.00); SetPlayerCameraPos(_playerid, 1473.7114, -1010.3983, 68.0122); SetPlayerCameraLookAt(_playerid, 1472.8909, -1009.8300, 68.2072); } }
Also, in OnPlayerRequestClass I use TogglePlayerSpectating(playerid, true);.
Camera stays in village.