All pastes #408777 Raw Edit

tutorial 3 part 1

public cpp v1 · immutable
#408777 ·published 2007-03-25 02:36 UTC
rendered paste body
#include <a_samp>main(){	print("\n----------------------------------");	print(" My first deathmatch mode by NAME");	print("----------------------------------\n");}#define POCKET_MONEY 500#define START_WEAPON 27#define START_AMMO 200public OnGameModeInit(){	SetGameModeText("Deathmatch");	AddPlayerClass(1, -1643.2673, -2245.1335, 31.4766, 1.2814, 7, 1, 22, 100, 0, 0); // my first character	AddPlayerClass(2, -1360.4752, -2112.6875, 30.2348, 224.2845, 6, 1, 23, 50, 0, 0); //	AddPlayerClass(121, -1740.3165, -2090.4006, 39.7106, 256.3793, 5, 1, 24, 30, 0, 0); //	AddStaticVehicle(401, -1764.6294, -2086.7019, 47.1236, 257.8369, 113, 113); // my first car	AddStaticVehicle(401, -1633.3375, -2251.4619, 28.7141, 89.0023, 113, 113); // This vehicle is parked under a roof so was dropped a bit	AddStaticVehicle(403, -1303.2861, -2121.0093, 25.5832, 176.7224, 28, 1); //	AddStaticPickup(362, 2, -1673.1672, -2165.0496, 35.7388);	return 1;}public OnPlayerRequestClass(playerid, classid){	SetPlayerPos(playerid, -1798.7191, -2270.0239, 67.1363);	SetPlayerFacingAngle(playerid, 130.0296);	SetPlayerCameraPos(playerid, -1801.9762, -2272.5999, 67.8387);	SetPlayerCameraLookAt(playerid, -1798.7191, -2270.0239, 67.1363);	return 1;}public OnPlayerRequestSpawn(playerid){	return 1;}public OnGameModeExit(){	return 1;}public OnPlayerConnect(playerid){	return 1;}public OnPlayerDisconnect(playerid){	return 1;}public OnPlayerSpawn(playerid){	// Moved in here as it's the only place it's ever used so there's no point	// having it global.	static const		Float:scSpawnPoints[][4] =		{			{-1643.2673, -2245.1335, 31.4766, 1.2814},			{-1360.4752, -2112.6875, 30.2348, 224.2845},			{-1740.3165, -2090.4006, 39.7106, 256.3793}		};	// random has problems with low numbers (lot's of sticking) so these are	// two possible solutions.  The first is useful in the order of 10, second	// is useful in the order 100 as above starts getting predictable.	new		spawn2 = random(sizeof (scSpawnPoints) * 1000) / 1000, // More variable		spawn = GetTickCount() % sizeof (scSpawnPoints); // Easy but flawed			// spawn2 is just an example so tell the compiler not to warn you about it	#pragma unused spawn2	SetPlayerPos(playerid, scSpawnPoints[spawn][0], scSpawnPoints[spawn][1], scSpawnPoints[spawn][2]);	SetPlayerFacingAngle(playerid, scSpawnPoints[spawn][3]);	GivePlayerMoney(playerid, POCKET_MONEY);	GivePlayerWeapon(playerid, START_WEAPON, 200);		SetPlayerCheckpoint(playerid, -1499.4589, -2155.8435, 2.5238, 5.0);	return 1;}public OnPlayerDeath(playerid, killerid, reason){	if (killerid != INVALID_PLAYER_ID)	{		GivePlayerMoney(killerid, GetPlayerMoney(playerid));	}	ResetPlayerMoney(playerid);	SendDeathMessage(killerid, playerid, reason);	return 1;}public OnVehicleSpawn(vehicleid){	return 1;}public OnVehicleDeath(vehicleid, killerid){	return 1;}public OnPlayerText(playerid, text[]){	return 1;}public OnPlayerPrivmsg(playerid, senderid, text[]){	return 1;}public OnPlayerCommandText(playerid, cmdtext[]){	return 0;}public OnPlayerInfoChange(playerid){	return 1;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){	return 1;}public OnPlayerExitVehicle(playerid, vehicleid){	return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){	return 1;}public OnPlayerEnterCheckpoint(playerid){	GameTextForPlayer(playerid, "~b~Welcome to your first checkpoint!", 5000, 3);	return 1;}public OnPlayerLeaveCheckpoint(playerid){	GameTextForPlayer(playerid, "~b~See you later!", 5000, 3);	return 1;}