Tessék:
//SUMO GM
#include <a_samp>
main()
{
print(\"\\n----------------------------------\");
print(\" SUMO GM by mihaibr\");
print(\"----------------------------------\\n\");
}
#pragma tabsize 0
new Float:Test[3];
new pVehicle[MAX_PLAYERS] = {-1};
new vArray[25] =
{
401, 402, 406, 413, 415, 424, 431, 439, 444, 448, 451, 470, 475, 491, 494, 500, 510, 542, 544, 552, 561, 568, 597, 602, 609
};
new Float:pSpawns[4][4] =
{ {1462.1420,-1083.7144,214.9081,51.8804},
{1439.6787,-1081.1829,214.9047,323.3311},
{1440.0782,-1050.4888,214.9077,236.8649},
{1464.7332,-1053.8882,214.9050,141.1169}
};
#define COLOR_RED 0xE60000AA
//where the player will spawn
#define player_x 1175.6459
#define player_y -1183.2511
#define player_z 91.4111
#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 1175.6459
#define camera_y -1183.2511
#define camera_z 91.4111
//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];
new Float:RandomSpawn[][4] =
{
// Positions, (X, Y, Z and Facing Angle)
{1462.1420,-1083.7144,214.9081,51.8804},
{1439.6787,-1081.1829,214.9047,323.3311},
{1440.0782,-1050.4888,214.9077,236.8649},
{1464.7332,-1053.8882,214.9050,141.1169}
};
public OnGameModeInit()
{
SetGameModeText(\"SUMO GM\");
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
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,1175.6459,-1183.2511,91.4111); //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
return 1;
}
public OnPlayerConnect(playerid)
{ //loading the animation libraries
//so the timer can be executed again
PlayerInfo[playerid][spawnDance] = true;
ApplyAnimation(playerid,\"DANCING\",\"DNCE_M_B\",4.0,1,0,0,0,-1); //preventing a bug for the animation not being applied the first time OnPlayerRequestClass is called
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer( PlayerInfo[playerid][spawnTimer] );
return 1;
}
public OnPlayerSpawn(playerid)
{
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
new rand = random(sizeof(RandomSpawn));
// SetPlayerPos to the random spawn data
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
// SetPlayerFacingAngle to the random facing angle data
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
new vehicle = random(24);
pVehicle[playerid] = CreateVehicle(vArray[vehicle], pSpawns[playerid][0], pSpawns[playerid][1], pSpawns[playerid][2], pSpawns[playerid][3], -1, -1, 100000);
PutPlayerInVehicle(playerid, pVehicle[playerid], 0);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
{ if(!strcmp(\"/kill\", cmdtext, true))
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_RED, \"Somn usor\");
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
GetPlayerPos(playerid, Test[0], Test[1], Test[2]);
if(Test[2]<130) return SetPlayerHealth(playerid, 0);
else
SetPlayerHealth(playerid, 100);
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
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;
}