OnPlayerSpawn
#1

Hey guys. I recently made DM zone and commands and everything but now when player dies he spawns in that DM zone (and that is what i want) but he spawns with no guns and he can type again /dm (and i don't want that). How can i fix this. Here is my script of that
Код:
if(PlayerJoinedDMZone[playerid] == 1)
    {
        new randomcoords = random(sizeof(DMSpawn));
        SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
    }
    return 1;
}

CMD:dm(playerid, params[])
{
    PlayerJoinedDMZone[playerid] = 1;
    new randomcoords = random(sizeof(DMSpawn));
    SPP(playerid, DMSpawn[randomcoords][0],
				  DMSpawn[randomcoords][1],
	              DMSpawn[randomcoords][2]);
	GivePlayerWeapon(playerid, 26, 100);
	GivePlayerWeapon(playerid, 22, 100);
	GivePlayerWeapon(playerid, 25, 100);
	GivePlayerWeapon(playerid, 28, 500);
	GivePlayerWeapon(playerid, 30, 100);
	GivePlayerWeapon(playerid, 33, 50);
	SetPlayerArmour(playerid, 100);
	SPH(playerid, 100);
	return 1;
}

CMD:napustidm(playerid, params[])
{
	PlayerJoinedDMZone[playerid] = 0;
 	SCM(playerid, 0xF81414, "Napustili ste DM zonu");
 	SPP(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}
Reply
#2

i've putted
Код:
if(PlayerJoinedDMZone[playerid] == 1)
    {
        new randomcoords = random(sizeof(DMSpawn));
        SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
    }
    return 1;
}
under OnPlayerSpawn
Reply
#3

Okay, so player spawns at DM zone after dying? And that's how you want it to work, but player doesnt get the weps? Well, just check your variable if its equal to 1 (the DM zone one) give him the guns.

Edit: I saw your reply, I'm from phone chances are this code might miss some braces or whatever.

Код:
if(PlayerJoinedDMZone[playerid] == 1)
    {
        new randomcoords = random(sizeof(DMSpawn));
        SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
GivePlayerWeapon(playerid, 26, 100);
	GivePlayerWeapon(playerid, 22, 100);
	GivePlayerWeapon(playerid, 25, 100);
	GivePlayerWeapon(playerid, 28, 500);
	GivePlayerWeapon(playerid, 30, 100);
	GivePlayerWeapon(playerid, 33, 50);
	SetPlayerArmour(playerid, 100);
	SPH(playerid, 100);
    }
    return 1;
}
Reply
#4

But there is another problem. After he spawn in DM zone after dying server doesn't recognize him as player in DM zone and he can type /dm again. Maybe there is something wrong in /dm code
Код:
CMD:dm(playerid, params[])
{
    PlayerJoinedDMZone[playerid] = 1;
    new randomcoords = random(sizeof(DMSpawn));
    SPP(playerid, DMSpawn[randomcoords][0],
				  DMSpawn[randomcoords][1],
	              DMSpawn[randomcoords][2]);
	GivePlayerWeapon(playerid, 26, 100);
	GivePlayerWeapon(playerid, 22, 100);
	GivePlayerWeapon(playerid, 25, 100);
	GivePlayerWeapon(playerid, 28, 500);
	GivePlayerWeapon(playerid, 30, 100);
	GivePlayerWeapon(playerid, 33, 50);
	SetPlayerArmour(playerid, 100);
	SPH(playerid, 100);
	SCM(playerid, 0xF81414, "Dobrodosli u DM zonu. Srecno :)");
	return 1;
}
Reply
#5

Do you change the variable value OnPlayerDeath?
Reply
#6

Should it go like this?/
Код:
	if(PlayerJoinedDMZone[playerid] == 1)
	{
	    PlayerJoinedDMZone[playerid] = 1;
	}
this goes under OnPlayerDeath
Reply
#7

I'm not sure what are you trying to say though. You're checking if variable's value is 1, and then setting it back to 1. Lol
Reply
#8

Quote:
Originally Posted by Micko123
Посмотреть сообщение
Should it go like this?/
Код:
	if(PlayerJoinedDMZone[playerid] == 1)
	{
	    PlayerJoinedDMZone[playerid] = 1;
	}
this goes under OnPlayerDeath
The OnPlayerDeath, shall look like this
Код:
 	if(PlayerJoinedDMZone[playerid] == 1)
	{
	    PlayerJoinedDMZone[playerid] = 0;
	}
Reply
#9

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
The OnPlayerDeath, shall look like this
Код:
 	if(PlayerJoinedDMZone[playerid] == 1)
	{
	    PlayerJoinedDMZone[playerid] = 0;
	}
No no. You don't understand. I want playe when he dies in DM zone to stay in DM zone and to respawn there. So my code works perfectly But thank you anyway
Reply
#10

Quote:
Originally Posted by Micko123
Посмотреть сообщение
No no. You don't understand. I want playe when he dies in DM zone to stay in DM zone and to respawn there. So my code works perfectly But thank you anyway
Oh okay.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)