My questions here. (please have a look here, this will be updated frequently) -
[dN]Eagle - 23.01.2010
Alright, I can't figure out how to do it myself and I can't be bothered to use search function as I used ****** and nothing good came up.
I want to kill players who come below the Z.Z coordinate, in this case it is 70.0
Someone please help me
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
There are many ways in which you can do something like this, one example is:
pawn Code:
public OnPlayerUpdate(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z < 70)
{
SetPlayerHealth(playerid, 0);
}
return 1;
}
I'm sure there is a better way to do this, but this is one simple solution.
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
I am going to try it, thanks!
EDIT: It works, thanks very much
Re: Kill players when they are lower then "Z.Z" -
mansonh - 23.01.2010
As suggested there are many ways.
I wouldn't however recommend onplayerupdate, it is called A LOT, as in 20+ times per second per player (unless you want it to kill them the exact ms they reach -70, thats a strain on your server for something so small)
If you just want to kill anyone who goes below it, then use a timer, its much easier on your server, same code as llamas.
pawn Code:
public OnGameModeInit()
{
SetTimer("TimerDepthCheck", 1000, 1); //depending how worried you are on how suddenly it kills them you can change it 1000 = 1s
}
forward TimerDepthCheck();
public TimerDepthCheck()
{
for(new playerid=0; playerid<GetMaxPlayers(); playerid++)
{
if(!IsPlayerConnected(playerid)) continue;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z < 70)
{
SetPlayerHealth(playerid, 0);
}
return 1;
}
}
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
I am getting this error with yours mansonh.
Code:
myscriptnotyours.pwn(117) : warning 209: function "TimerDepthCheck" should return a value
Code:
LINE 103: public TimerDepthCheck()
{
for(new playerid=0; playerid<GetMaxPlayers(); playerid++)
{
if(!IsPlayerConnected(playerid)) continue;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z < 70)
{
SetPlayerHealth(playerid, 0);
}
return 1;
}
LINE 117: }
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
Quote:
Originally Posted by [dN
Eagle ]
I am getting this error with yours mansonh.
Code:
myscriptnotyours.pwn(117) : warning 209: function "TimerDepthCheck" should return a value
|
Add a return 1; above the last bracket }
And that's another simple solution.
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Lmfao, how come I didn't figured that out myself
Thanks for the help tho.
Re: Kill players when they are lower then "Z.Z" -
mansonh - 23.01.2010
Oops, my bad, just coding on the fly, not actually compiling anything i am writing (not bad, only one silly error :P)
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
I am just going to use this topic because I have another question.
When I try to spawn it automaticly gives me the CJ skin while I chose a different class like "demolition"
P.S: You can check it out @ 77.248.87.200:7777
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
What is your OnPlayerSpawn and your OnPlayerRequestSpawn?
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Code:
public OnPlayerSpawn(playerid)
{
return 1;
}
Code:
public OnPlayerRequestSpawn(playerid)
{
if(gTeam[playerid] == TEAM_HOBO)
{
SetPlayerColor(playerid,TEAM_HOBO_COLOR);
}
else if(gTeam[playerid] == TEAM_RICH)
{
SetPlayerColor(playerid,TEAM_RICH_COLOR);
}
return 1;
}
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
Nothing there that would cause that.
What are your AddPlayerClass'es?
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Code:
// TEAM HOBO
AddPlayerClass(137, 3254.3262, -1889.8865, 73.5436, 354.3818, 24, 150, 30, 1000, 8, 1); // ATTACKER
AddPlayerClass(135, 3265.1843, -1897.1830, 75.7411, 176.1561, 34, 150, 42, 200, 24, 100); // SNIPER
AddPlayerClass(134, 3193.9927, -1877.9962, 76.4372, 269.2565, 37, 500, 18, 10, 9, 1); // DEMOLITION
// TEAM RICH
AddPlayerClass(35, 3137.5471, -1887.6497, 72.7787, 174.3979, 24, 150, 31, 500, 8, 1); // ATTACKER
AddPlayerClass(36, 3127.6685, -1881.5739, 74.9761, 358.3756, 34, 150, 42, 200, 24, 100); // SNIPER
AddPlayerClass(37, 3198.9180, -1901.3778, 76.4497, 86.8948, 37, 500, 18, 10, 9, 1); // DEMOLITION
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
That's odd, there's nothing there that I can see that would cause that.
Have you used SpawnPlayer? Any filterscripts loaded?
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Problem solved.
It was caused by admin skin.
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Another question.
I want an admin to i.e type /dfo (disablefalloff).
This will command must overrule the Z < 70 so he can go anywhere he want to.
How can I do that?
EDIT: I am using lAdmin but if I place <ladmin> on top of my script it gives me an error when I try to compile.
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
At top:
pawn Code:
#include <IsPlayerLAdmin>
In OnGameModeInit:
pawn Code:
new Falloff[MAX_PLAYERS];
In OnPlayerConnect:
In OnPlayerCommandText:
pawn Code:
[The command code here]
if(IsPlayerLAdmin(playerid))
{
if(Falloff[playerid] == 0)
{
Falloff[playerid] = 1;
SendClientMessage(playerid, Color, "You won't be killed if you fall off!");
}
else
{
Falloff[playerid] = 0;
SendClientMessage(playerid, Color, "You will now be killed if you fall off!");
}
return 1;
}
else
{
SendClientMessage(playerid, Color, "You are not an admin!");
return 1;
}
Lastly, from before change the TimerDepthCheck to this:
pawn Code:
public TimerDepthCheck()
{
for(new playerid=0; playerid<GetMaxPlayers(); playerid++)
{
if(!IsPlayerConnected(playerid)) continue;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z < 70 && Falloff[playerid] == 0)
{
SetPlayerHealth(playerid, 0);
}
return 1;
}
}
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
Code:
*****.pwn(3) : fatal error 100: cannot read from file: "IsPlayerLAdmin"
Re: Kill players when they are lower then "Z.Z" -
llama - 23.01.2010
Make sure you have the IsPlayerLAdmin include from the topic
http://forum.sa-mp.com/index.php?topic=36990.0
It goes in your server\pawno\include\ folder.
Re: Kill players when they are lower then "Z.Z" -
[dN]Eagle - 23.01.2010
By ladmin I mean Lux Admin
EDIT: Are they the same?
EDIT2: I will just try that one and if it works I will use it because they look similar.