SA-MP Forums Archive
shotgun room - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: shotgun room (/showthread.php?tid=232895)



shotgun room - Madsen - 28.02.2011

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


Re: shotgun room - Baboon - 28.02.2011

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;



Re: shotgun room - Madsen - 28.02.2011

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


Re: shotgun room - sim_sima - 01.03.2011

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


Re: shotgun room - Lorrden - 01.03.2011

Doesn't OnPlayerDeath returns OnPlayerSpawn?


Re: shotgun room - Hashski - 01.03.2011

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;



Re: shotgun room - Madsen - 01.03.2011

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


Re: shotgun room - Madsen - 02.03.2011

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 ?


Re: shotgun room - Lorrden - 02.03.2011

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;
}



Re: shotgun room - Madsen - 02.03.2011

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?