All pastes #243673 Raw Edit

Mine

public text v1 · immutable
·published 2006-11-08 20:00 UTC
rendered paste body
#include <a_samp>

new gCurrentCP[MAX_PLAYERS];

main()
{
	print("\n----------------------------------");
	print("  This is a blank GameModeScript");
	print("----------------------------------\n");
}

public timer() {
	CheckPlayerLocations();
}


public OnGameModeInit()
{
	print("GameModeInit()");
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	SetTimer("CheckPlayerLocations",200,1);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnGameModeExit()
{
	print("GameModeExit()");
	return 1;
}

public OnPlayerConnect(playerid)
{
	printf("OnPlayerConnect(%d)", playerid);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	printf("OnPlayerDisconnect(%d)", playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	printf("OnPlayerSpawn(%d)", playerid);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	printf("OnVehicleSpawn(%d)", vehicleid);
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	printf("OnVehicleDeath(%d, %d)", vehicleid, killerid);
	return 1;
}

public OnPlayerText(playerid)
{
	printf("OnPlayerText(%d)", playerid);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp(cmdtext, "/mycommand", true)==0)
	{
	    /* Do something here */
	    return 1;
	}
	return 0;
}

public OnPlayerInfoChange(playerid)
{
	printf("OnPlayerInfoChange(%d)");
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	DisablePlayerCheckpoint(playerid);
	
	switch (gCurrentCP[playerid]) {
	case 1: //cp to sf pd
	    {
	        SetPlayerInterior(playerid,10);
	        SetPlayerPos(playerid,246.40,110.84,1003.22);
	    }
	case 2: //cp to hidden safehouse
	    {
	        SetPlayerInterior(playerid,12);
	        SetPlayerPos(playerid,2324.33,-1144.79,1050.71);
	    }
	case 3: //cp out of sf pd
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1961.1506,1345.8337,15.3746);
	    }
	case 4: //cp out of hidden safehouse
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1960.6218,1339.8765,15.3746);
	    }
	}
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	printf("OnPlayerLeaveCheckpoint(%d)", playerid);
	return 1;
}

public CheckPlayerLocations() {

  new Float:X, Float:Y, Float:Z;

  new currentplayer;
  for (currentplayer = 0; currentplayer <  MAX_PLAYERS; currentplayer++) {
    GetPlayerPos(currentplayer, X, Y, Z);
        if(IsPlayerInCircle(currentplayer, 1962.3502,1345.9735,4)) {    //goto sf pd
			if (gCurrentCP[currentplayer] != 1) {
				SetPlayerCheckpoint(currentplayer,1962.5,1345.9735,16.0142,1);
				gCurrentCP[currentplayer] = 1;
			}
        } else if (IsPlayerInCircle(currentplayer, 1962.5535,1339.8729,4)) {    //goto hidden safehouse
			if (gCurrentCP[currentplayer] != 2) {
				SetPlayerCheckpoint(currentplayer,1962.5,1339.8729,16.0142,1);
				gCurrentCP[currentplayer] = 2;
			}
        } else if (IsPlayerInCircle(currentplayer, 246.2313,108.8046,4)) {    //go out of sf pd
			if (gCurrentCP[currentplayer] != 3) {
				SetPlayerCheckpoint(currentplayer,246.2313,108.8046,1003.2188,1);
				gCurrentCP[currentplayer] = 3;
			}
        } else if (IsPlayerInCircle(currentplayer, 2324.5632,-1148.2930,4)) {    //go out of hidden safehouse
			if (gCurrentCP[currentplayer] != 4) {
				SetPlayerCheckpoint(currentplayer,2324.5632,-1148.2930,1050.7101,1);
				gCurrentCP[currentplayer] = 4;
			}
        } else {
			DisablePlayerCheckpoint(currentplayer);
            gCurrentCP[currentplayer] = 0;
        }
      }
  return 1;
}

public IsPlayerInCircle(playerid,Float:x,Float:y,radius)
{
	if(GetPlayerDistanceToPoint(playerid,x,y) < radius){
		return 1;
	}
	return 0;
}

public GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
{
	new Float:x1,Float:y1,Float:z1;
	new Float:tmpdis;
	GetPlayerPos(playerid,x1,y1,z1);
	tmpdis = floatsqroot(floatpower(floatabs(floatsub(Float:x,x1)),2)+floatpower(floatabs(floatsub(Float:y,y1)),2));
	return floatround(tmpdis);
}