20.09.2013, 11:05
Can somebody help me with this?
public OnGameModeInt()
{
//Paste that line in this
return 1;
}
first step: find a hospital then use /save when you want to spawn
second step: goto Documents/Gta San Andreas User Files/SAMP/savedposition.txt copy the line save pos third step: goto Pawn write in your gamemode pawn Код:
|
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, second number, third number, fourth number);
return 1;
}
new died[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
died[playerid] =0;
}
//OnPlayerDeath
died[playerid] =1;
//OnPlayerSpawn
if(died[playerid] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 100, x, y, z)) //I don't know the exact distance, it needs calculations, you do it. and change 100 to a good distance, close to two hospitals, so yeah, use this. //post LV axis for example
{
SetPlayerPos(playerid, x, y, z); //hospital spawn
died =0;
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 100, x, y, z)) //post SF axis for example
{
SetPlayerPos(playerid, x, y, z); //hospital spawn
died =0;
return 1;
}
//and so on
}
SetPlayerPos(playerid, x, y, z); //normal spawns
Get the second, third and fourth number from what you have saved:
pawn Код:
|
new dead[MAX_PLAYERS]; // On top of the script.
public OnPlayerConnect(playerid)
{
dead[playerid] = 0;
return 1;
}
public OnPlayerspawn(playerid)
{
if(dead[playerid] == 1) SpawnToHospital(playerid);
return 1;
}
stock SpawnToHospital(playerid)
{
dead[playerid] = 0;
static const hspawns[][4] =
{
{x coord, y coord, z coord, angle},
{x1 coord, y1 coord, z1 coord, angle1},
// Other hospital spawns.
// Last line must not have ",".
};
new Float:spawndist[2]; // Change to the number of hospital spawnpoints you use.
new Float:distance = 10000.0, closestspawn;
spawndist[0] = GetPlayerDistanceFromPoint(playerid, x, y, z); // 1st hospital spawn.
spawndist[1] = GetPlayerDistanceFromPoint(playerid, x1, y1, z1); // 2nd hospital spawn.
// Other Hospital Spawns like above.
for(new i = 0; i < sizeof(spawndist); i++)
{
if(spawndist[i] < distance) distance = spawndist[i], closestspawn = i;
}
SetPlayerPos(playerid, hspawns[closestspawn][0], hspawns[closestspawn][1], hspawns[closestspawn][2]);
SetPlayerFacingAngle(playerid, hspawns[closestspawn][3]);
}