Example random spawn needed -
smokeweed - 04.02.2012
Can someone give me a example for random spawns? I spawn with dialogs
pawn Код:
case DIALOG_MEDIC:
{
if( response )
{
if(GetPlayerScore(playerid) <= 5) return echo(playerid,COLOR_DARKRED,"dddd");
gPlayerClass[playerid] = MEDIC_CLASS;
GivePlayerWeapon(playerid, 3, 1);//knuppel
GivePlayerWeapon(playerid, 22, 15);//9mm
GivePlayerWeapon(playerid, 25, 25);//shotgun
GivePlayerWeapon(playerid, 31, 90);//m4
GivePlayerWeapon(playerid, 29, 50);//mp5
SetPlayerHealth(playerid, 75);
return 1;
}
Thanks
Re: Example random spawn needed -
[ABK]Antonio - 04.02.2012
pawn Код:
new Float:RandSpawns[2][4] = { //our array
{X, Y, Z, Angle},
{X, Y, Z, Angle}
};
Then when we want to spawn them
pawn Код:
new rand = random(sizeof(RandSpawns));
SetPlayerPos(playerid, RandSpawns[rand][0], RandSpawns[rand][1], RandSpawns[rand][2]);
SetPlayerFacingAngle(playerid, RandSpawns[rand][3]);
Re: Example random spawn needed -
smokeweed - 04.02.2012
Okay and how to get facing angle? And btw I have 7 teams,
Re: Example random spawn needed -
Konstantinos - 04.02.2012
Do you mean the angle at coordinates or function?
pawn Код:
// Coordinates:
// You type /save in-game and on the savedpositions.txt
AddPlayerClass( 23, 379.2453, 2532.2297, 16.5969, 313.1964, 0, 0, 0, 0, 0, 0 ); // An Example
// The parameters are:
AddPlayerClass( skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo )
// So the Angle is the 5th: 313.1964
pawn Код:
// Function:
new
Float:Angle;
GetPlayerFacingAngle( playerid, Angle );
Re: Example random spawn needed -
smokeweed - 04.02.2012
okay thanks
Re: Example random spawn needed -
[ABK]Antonio - 04.02.2012
When you type /save it does this
pawn Код:
AddPlayerClass(skin,x,y,z,angle,gun1,ammo1,gun2,ammo2,gun3,ammo3);
EDIT: Oh dwayne already answered lol
Re: Example random spawn needed -
smokeweed - 04.02.2012
I know:P and ehh I have 7 teams, how can I make random spawns for each team?
Re: Example random spawn needed -
Konstantinos - 04.02.2012
pawn Код:
new Float:RandSpawns1[ ][ 4 ] = // Team 1
{
{X, Y, Z, Angle},
{X, Y, Z, Angle}
};
new Float:RandSpawns1[ ][ 4 ] = // team 2
{
{X, Y, Z, Angle},
{X, Y, Z, Angle}
};
// Add 5 more variables with random spawns for each Team
public OnPlayerSpawn( playerid )
{
new
rand;
if( gTeam[ playerid ] == Team1 )
{
rand = random( sizeof( RandSpawns1 ) );
SetPlayerPos( playerid, RandSpawns1[ rand ][ 0 ], RandSpawns1[ rand ][ 1 ], RandSpawns1[ rand ][ 2 ] );
SetPlayerFacingAngle( playerid, RandSpawns1[ rand ][ 3 ] );
}
if( gTeam[ playerid ] == Team2 )
{
rand = random( sizeof( RandSpawns1 ) );
SetPlayerPos( playerid, RandSpawns2[ rand ][ 0 ], RandSpawns2[ rand ][ 1 ], RandSpawns2[ rand ][ 2 ] );
SetPlayerFacingAngle( playerid, RandSpawns2[ rand ][ 3 ] );
}
// For each Team too
return 1;
}