לינק למקור:
http://forum.sa-mp.com/index.php?topic=115765.0
דוגמא:
אם אין לכם מוד LARP או GF רק מוד רגיל תעתיקו את זה למעלה:
PHP Code:
//where the player will spawn
#define player_x -250.9738
#define player_y 2585.6497
#define player_z 63.5703
#define player_angle 210.3500
//PLAYER CAMERA, THE ONE YOU CREATE SO YOU CAN SEE THE PLAYER
//note: for a better effect, let the camera be a few meters away from the player
#define camera_x -248.9410
#define camera_y 2581.5327
#define camera_z 64.9334
//ATTENTION; THESE ARE MILISECONDS
//untested, but it should work in theory. The smaller the value, the faster the camera.
#define moving_speed 50
//declaring stuff
//IMPORTANT: FOR THE CODE TO WORK, YOU MUST DEFINE THE ENUM BEFORE PlayerInfo
//just copy it like It's written here
enum pInfo
{
bool:SpawnDance,
Float:SpawnAngle,
SpawnTimer
};
new PlayerInfo[MAX_PLAYERS][pInfo];
אבל אם יש לכם מוד ארפי תשימו כך:
PHP Code:
//where the player will spawn
#define player_x -250.9738
#define player_y 2585.6497
#define player_z 63.5703
#define player_angle 210.3500
//PLAYER CAMERA, THE ONE YOU CREATE SO YOU CAN SEE THE PLAYER
//note: for a better effect, let the camera be a few meters away from the player
#define camera_x -248.9410
#define camera_y 2581.5327
#define camera_z 64.9334
//ATTENTION; THESE ARE MILISECONDS
//untested, but it should work in theory. The smaller the value, the faster the camera.
#define moving_speed 50
//declaring stuff
//IMPORTANT: FOR THE CODE TO WORK, YOU MUST DEFINE THE ENUM BEFORE PlayerInfo
//just copy it like It's written here
עכשיו תחפשו במוד PINFO מצאתם? רדו למטה לסוף הרשימה ותוסיפן את זה:
PHP Code:
enum pInfo
{
bool:SpawnDance,
Float:SpawnAngle,
SpawnTimer
};
וזהו עכשיו גם למי שיש מוד DM וגם ארפי לעקוב אחרי הדברים שאני מראה..
לכו לפובליק
PHP Code:
public OnPlayerRequestClass(playerid, classid)
שם איפה שאתם רואים
SetPlayerCameraPos
וכל אלה תשמרו להם גיבוי אם אחרי זה לא תאהבו תמערכת ותמחקו את כל הקודים האלה שם..לא את כל הפאבליק!
ואז שימו:
PHP Code:
SetPlayerPos(playerid, player_x,player_y,player_z);
SetPlayerFacingAngle(playerid, player_angle);
SetPlayerCameraPos(playerid, camera_x,camera_y,camera_z);
SetPlayerCameraLookAt(playerid, player_x,player_y,player_z);
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //smooth dancing. It's most fitting to the music
PlayerPlaySound(playerid, 1097,-119.9460,23.1096,12.2238); //music, duh
//making sure the timer gets executed only once, so the camera doesn't go to fast
if (PlayerInfo[playerid][SpawnDance]) PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
PlayerInfo[playerid][SpawnDance] = false; //preventing the timer to execute again[RIGHT][/RIGHT]
לכו לפאבליק
PHP Code:
public OnPlayerConnect(playerid)
ושימו שם את הקוד:
PHP Code:
PlayerInfo[playerid][SpawnDance] = true;
לכו לפאבליק
PHP Code:
public OnPlayerSpawn(playerid)
ושימו:
PHP Code:
PlayerInfo[playerid][SpawnAngle] = 0.0; //so when you leave and another player comes, the camera will start from start
PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
SetCameraBehindPlayer(playerid); //to prevent some bugs
לכו לפאפבליק
PHP Code:
public OnPlayerDisconnect(playerid, reason)
הוסיפו לו את הקוד:
PHP Code:
KillTimer( PlayerInfo[playerid][SpawnTimer] );
הכי למטה במוד:
PHP Code:
//The business part of the code
forward MoveCamera(playerid);
public MoveCamera(playerid)
{
//this is called trigonometry. It makes the camera spin
//you can experiment with this line. Just change the values 2, 10 and 3 to make different effects
SetPlayerCameraPos(playerid, player_x - 2 * floatsin(-PlayerInfo[playerid][SpawnAngle], degrees), player_y - 10 * floatcos(-PlayerInfo[playerid][SpawnAngle], degrees), player_z + 3);
SetPlayerCameraLookAt(playerid, player_x, player_y, player_z + 0.5);
//changing the angle a little
PlayerInfo[playerid][SpawnAngle] += 0.5;
if (PlayerInfo[playerid][SpawnAngle] >= 360.0)
PlayerInfo[playerid][SpawnAngle] = 0.0;
}
וזהו תהנו! קרדיט לסאמפ העולמי