Random Spawns conflicting
#1

I have a problem with random spawns conflicting in 2 different dms

like if somebody dies in /west he spawns in 69

here is the code
Top
PHP код:
new Float:West_DMSpawns[][6] =
{
    {
2246.4597,-8967.2529,11.4128,157.5733},
    {
2272.2058,-9000.4375,13.3587,107.2517},
    {
2223.6631,-9047.2344,14.2966,2.3718},
    {
2151.7871,-8990.6797,4.6529,258.1311},
    {
2217.6982,-8952.7510,40.5316,157.6281},
    {
2053.6492,-9022.4492,45.9291,278.8784}
};
new 
Float:DMSpawns[][5] =

    {-
491.3325,3513.3535,10.1867,90.865},
    {-
563.2787,3512.9126,23.5641,267.8248},
    {-
593.4873,3506.6257,11.5412,277.3773},
    {-
611.4570,3523.1394,6.7774,258.9531},
    {-
552.4916,3495.9238,6.3913,91.2295}
}; 
public OnPlayerSpawn(playerid)
PHP код:
    if(InDM[playerid] == 1)//This will tell the script to respawn only the players that inside DM //////////West//////
    
{
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0); // We will set the interior to 0 (you can change it to your own DM)
        
SetPlayerVirtualWorld(playerid9); // and we will make the Virtual World in different world, so we wont mix with other players
        
new rand random(sizeof(West_DMSpawns)); // DM Spawn
        
SetPlayerPos(playeridWest_DMSpawns[rand][0], West_DMSpawns[rand][1], West_DMSpawns[rand][2]);// we will set the player position at DM
        
SetPlayerFacingAngle(playeridWest_DMSpawns[rand][3]); // Also facing Angle
        //and we will give him weapons, I will give 2 weapons
        
GivePlayerWeapon(playerid,24,500);
        
GivePlayerWeapon(playerid,25,200);
        
GivePlayerWeapon(playerid,33,200);
        
GivePlayerWeapon(playerid,4,0);
        
//you can edit them, or add more weapons
    
}
        if(
InDM[playerid] == 1)// tell the script to respawn only the players that inside DM /////69///////////
    
{
        
ResetPlayerWeapons(playerid);
        
SetPlayerInterior(playerid0); // We will set the interior to 0 (
        
SetPlayerVirtualWorld(playerid10); // and we will make the Virtual World in different world, so we wont mix with other players
        
new rand random(sizeof(DMSpawns)); // DM Spawn
        
SetPlayerPos(playeridDMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]);//set the player position at DM
        
SetPlayerFacingAngle(playeridDMSpawns[rand][3]); // Also facing Angle
        
GivePlayerWeapon(playerid,38,9999);
    } 
PHP код:
COMMAND:west(playeridparams)
     {
        new 
PlayerName[MAX_PLAYER_NAME];//Player name
        
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
        if(
InDM[playerid] == 0)//if the player is not in DM
        
{//then
            
ResetPlayerWeapons(playerid);
            
InDM[playerid] = 1// Now we will set him in DM so he will respawn at DM
            
SendClientMessage(playeridCOLOR_LIGHTBLUE "You have joined /west, to leave type /west again");//Message to tell him that he joined DM
            
format(Stringsizeof(String), "Server:{FFFFFF}%s(%d) has joined (/west)"PlayerNameplayerid);
            
SendClientMessageToAll(COLOR_LIGHTBLUEString);//Message to tell everyone that he joined DM
            
ResetPlayerWeapons(playerid);
            
SetPlayerInterior(playerid0); // we will set he's interior to 0
            
SetPlayerVirtualWorld(playerid9); // and same here Virtual World to 10
            
new rand random(sizeof(West_DMSpawns)); // DM Spawn
            
SetPlayerPos(playeridWest_DMSpawns[rand][0], West_DMSpawns[rand][1], West_DMSpawns[rand][2]);
            
SetPlayerFacingAngle(playeridWest_DMSpawns[rand][3]);
            
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Old West Gunfights!");
            
GivePlayerWeapon(playerid,24,500);
            
GivePlayerWeapon(playerid,25,200);
            
GivePlayerWeapon(playerid,33,200);
            
GivePlayerWeapon(playerid,4,0);
        }
        else {
//if the player is already in DM, he will leave
            
InDM[playerid] = 0//So now we will set him as not in DM
            
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have left /west to join again type /west");//We will send him a message to tell him that he left
            
SpawnPlayer(playerid);//We will spawn the player now
            
SetPlayerHealth(playerid100);//set he's health to 100
            
ResetPlayerWeapons(playerid);// and reset he's weapons
            
SetPlayerVirtualWorld(playerid0);//we will set he's virtual world to 0
            
SetPlayerInterior(playerid0);//also interior to 0
        
}
        return 
1;

PHP код:
COMMAND:69(playeridparams)
     {
        new 
PlayerName[MAX_PLAYER_NAME];//Player name
        
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
        if(
InDM[playerid] == 0)//if the player is not in DM
        
{//then
            
ResetPlayerWeapons(playerid);
            
InDM[playerid] = 1// Now we will set him in DM so he will respawn at DM
            
SendClientMessage(playeridCOLOR_LIGHTBLUE "You have joined /69, to leave type /69 again");//Message to tell him that he joined DM
            
format(Stringsizeof(String), "Server:{FFFFFF}%s(%d) has joined (/69)"PlayerNameplayerid);
            
SendClientMessageToAll(COLOR_LIGHTBLUEString);//Message to tell everyone that he joined DM
            
ResetPlayerWeapons(playerid);
            
SetPlayerInterior(playerid0); // we will set he's interior to 0
            
SetPlayerVirtualWorld(playerid10); // and same here Virtual World to 10
            
new rand random(sizeof(DMSpawns)); // DM Spawn
            
SetPlayerPos(playeridDMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]);// set the player position at DM
            
SetPlayerFacingAngle(playeridDMSpawns[rand][3]); // Also facing Angle
            
GivePlayerWeapon(playerid,38,99999);
        }
        else {
//if the player is already in DM, he will leave
            
InDM[playerid] = 0//So now we will set him as not in DM
            
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have left /69 to join again type /69");//We will send him a message to tell him that he left
            
SpawnPlayer(playerid);//We will spawn the player now
            
SetPlayerHealth(playerid100);//set he's health to 100
            
ResetPlayerWeapons(playerid);// and reset he's weapons
            
SetPlayerVirtualWorld(playerid0);//we will set he's virtual world to 0
            
SetPlayerInterior(playerid0);//also interior to 0
        
}
        return 
1;

Reply


Messages In This Thread
Random Spawns conflicting - by baki - 31.07.2017, 11:27
Re: Random Spawns conflicting - by Tord - 31.07.2017, 14:34
Re: Random Spawns conflicting - by baki - 31.07.2017, 21:34

Forum Jump:


Users browsing this thread: 1 Guest(s)