shotgun room
#1

i am makeing a dm mode
and i want a shotgun room. I am makeing it like: when a player write /sw he goes into shotgunwar. when he dies in there he respawns there again.

the command they write to get into the room
Code:
if (strcmp("/sw", cmdtext, true, 10) == 0)
	{
		ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, 25, 1000);
		SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469);
		SetPlayerFacingAngle(playerid, 330.8037);
		SetPlayerVirtualWorld(playerid, 2);
		SetPlayerInterior(playerid, 17);
		return 1;
	}
public OnPlayerDeath(playerid, killerid, reason)
Code:
if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
	*then SetPlayerInterior(playerid, 17)
	&& SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469)
	&& SetPlayerFacingAngle(playerid, 330.8037)
	&& GivePlayerWeapon(playerid, 25, 1000)
	&& SetPlayerHealth(playerid, 100)
  	&& SetPlayerArmour(playerid, 100);
  	else
  	SetPlayerVirtualWorld(playerid, 0);
  	SetPlayerInterior(playerid, 0);
	return 1;
i dont get any warnings or errors. but i just spawn at standard place.

hope you can help me with this problem, i have tried everything that i can do
Reply
#2

Code:
if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
{
	SetPlayerInterior(playerid, 17);
	SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469);
	SetPlayerFacingAngle(playerid, 330.8037);
	GivePlayerWeapon(playerid, 25, 1000);
	SetPlayerHealth(playerid, 100)
  	SetPlayerArmour(playerid, 100);
else
{
  	SetPlayerVirtualWorld(playerid, 0);
  	SetPlayerInterior(playerid, 0);
}
return 1;
Reply
#3

well it does not help i get like 26 errors xD

this is how the script looks like:

Code:
public OnPlayerDeath(playerid, killerid, reason)
{

	SendClientMessage(killerid, 0xAA3333AA, "You just killed a player");
	SendClientMessage(killerid, COLOR_GREEN, "( $ ) +1000");
	GivePlayerMoney(killerid, 1000);
	SendClientMessage(playerid, 0xAA3333AA, "( $ ) -100");
	GivePlayerMoney(playerid, -100);
	
	
	// Cityhall
	if IsPlayerInRangeOfPoint(playerid, 200, 368.2953,173.8816,1008.3828)
	*then SendClientMessage(killerid, 0xFF0000FF, "( ! ) You are kicked by the server for: Kill in a Forbidden Place")
	&& Kick(killerid);
	else
	// Bank
	if IsPlayerInRangeOfPoint(playerid, 200, 347.2672,173.7295,1014.1875)
	*then SendClientMessage(killerid, 0xFF0000FF, "( ! ) You are kicked by the server for: Kill in a Forbidden Place")
	&& Kick(killerid);
	else
	// shotgun war
	if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
	*then SetPlayerInterior(playerid, 17)
	&& SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469)
	&& SetPlayerFacingAngle(playerid, 330.8037)
	&& GivePlayerWeapon(playerid, 25, 1000)
	&& SetPlayerHealth(playerid, 100)
  	&& SetPlayerArmour(playerid, 100);
  	else
  	SetPlayerVirtualWorld(playerid, 0);
  	SetPlayerInterior(playerid, 0);
	return 1;

}
and i have tried it your way with those { / } all the way and that bugged 2
Reply
#4

Well, remember to set the interior for the player, and get his position on death. Then set it when he respawns again, and give him the weapons you want him to get.
This makes no sense, but in my head it does!

Haha, dont worry. This comment is demanded by Madsen, im his friend
Reply
#5

Doesn't OnPlayerDeath returns OnPlayerSpawn?
Reply
#6

Quote:
Originally Posted by timothyinthehouse
View Post
Code:
if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
{
	SetPlayerInterior(playerid, 17);
	SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469);
	SetPlayerFacingAngle(playerid, 330.8037);
	GivePlayerWeapon(playerid, 25, 1000);
	SetPlayerHealth(playerid, 100)
  	SetPlayerArmour(playerid, 100);
else
{
  	SetPlayerVirtualWorld(playerid, 0);
  	SetPlayerInterior(playerid, 0);
}
return 1;
He missed a bracket.

pawn Code:
if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
{
    SetPlayerInterior(playerid, 17);
    SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469);
    SetPlayerFacingAngle(playerid, 330.8037);
    GivePlayerWeapon(playerid, 25, 1000);
    SetPlayerHealth(playerid, 100)
    SetPlayerArmour(playerid, 100);
}
else
{
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
}
return 1;
Reply
#7

Quote:
Originally Posted by Hashski
View Post
He missed a bracket.

pawn Code:
if IsPlayerInRangeOfPoint(playerid, 100, -19.0286,-175.3378,1003.5469)
{
    SetPlayerInterior(playerid, 17);
    SetPlayerPos(playerid, -19.0286,-175.3378,1003.5469);
    SetPlayerFacingAngle(playerid, 330.8037);
    GivePlayerWeapon(playerid, 25, 1000);
    SetPlayerHealth(playerid, 100)
    SetPlayerArmour(playerid, 100);
}
else
{
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
}
return 1;
it does not work you need to do it like i did..

I don't get any errors or warnings doing it my way. :P

but thx for the help
Reply
#8

Quote:
Originally Posted by Lorrden
View Post
Doesn't OnPlayerDeath returns OnPlayerSpawn?
So i need to make something on player death and then something in on player spawn that is connected to eachother ?
Reply
#9

Yes
Like:

pawn Code:
// On top:
new playerIsDead[MAX_PLAYERS];

//OnPlayerConnect(playerid)
    playerIsDead[playerid] = 0;

OnPlayerSpawn(playerid)
{
    if(playerIsDead[playerid] == 1)
    {
        //Do something here
    }
    return playerIsDead[playerid] = 0;
}
Reply
#10

Quote:
Originally Posted by Lorrden
View Post
Yes
Like:

pawn Code:
// On top:
new playerIsDead[MAX_PLAYERS];

//OnPlayerConnect(playerid)
    playerIsDead[playerid] = 0;

OnPlayerSpawn(playerid)
{
    if(playerIsDead[playerid] == 1)
    {
        //Do something here
    }
    return playerIsDead[playerid] = 0;
}
what do i need to do with onplayerdeath?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)