[HELP] Go jail if kill in safe zone
#1

Hi, i have benn searching a lot on the forum, but i dont find nothing, i find 1 only post, but its weird y full of insults, becouse 2 users were fightin :S.

I need this:

If you kill on bank, go prison

Can somebody help me with this?, im noob i cant script this on my own.

Bye
Reply
#2

Anyone?
Reply
#3

Hii ...
you could use the
Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
  return 1;
}
function to check if the Interior, when the player killed another player, is one of the interior id's of
a bank.
Look here -> https://sampwiki.blast.hk/wiki/InteriorIDs

.. and then check on:
Код:
OnPlayerDeath
if the interior of the killer is ( for example ) 5.
and if that's true ->
Код:
SetPlayerPos(killerid,xCoordinate,yCoordinate,zCoordinate);
Hope it helped you

LG Bearfist
Reply
#4



in the line:

public OnPlayerInteriorChange(playerid,newinteriorid,oldi nteriorid)

in oldinterior ((THE EXTERIOR)) what would be de ID ? 0 ?
Reply
#5

hm sry you don't need that function ^^

use:
Код:
GetPlayerInterior(playerid);
and on OnPlayerDeath check
Код:
if(GetPlayerInterior(killerid) == (for example)5)
and if that's true
Код:
SetPlayerPos(killerid,x,y,z);
P.S.: There is no Exterior ^^. If you aren't in any house or any room, your Interior is 0 .

LG Bearfist
Reply
#6

Where do i have to put the GetPlayerInterior?
Reply
#7

On OnPlayerDeath ...

If you start scripting in Pawn .. read the tutorial first ..
I did it too
.. it helps a lot =)
Reply
#8

LoL i was gettin 19 erros for a { , now im gettin 3 erros.

[code=PWNO]C:\Users\Fourmentel\Desktop\Juegos\ServerSAMP\SERV ERFINAL\gamemodes\sananmoneygrub0.5.pwn(172 : error 010: invalid function or declaration
C:\Users\Fourmentel\Desktop\Juegos\ServerSAMP\SERV ERFINAL\gamemodes\sananmoneygrub0.5.pwn(1730) : error 021: symbol already defined: "JB_SetPlayerPos"
C:\Users\Fourmentel\Desktop\Juegos\ServerSAMP\SERV ERFINAL\gamemodes\sananmoneygrub0.5.pwn(1733) : error 010: invalid function or declaration[/code]

This is my onplayerdeath()


[code=PWNO]
public OnPlayerDeath(playerid, killerid, reason)
{
new playercash;
new killedplayer[MAX_PLAYER_NAME];
new string[256];



playercash = GetPlayerMoney(playerid);
S_OnPlayerDeath(killerid);


if(killerid == INVALID_PLAYER_ID)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason );
}
else
{
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1 );
if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid])) {
GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
format(string, sizeof(string), "Ganaste la recompensa de %d por matar a %s.", bounty[playerid], killedplayer);
SendClientMessage(killerid, COLOR_GREEN, string);

GivePlayerMoney(killerid, bounty[playerid]);
bounty[playerid] = 0;
}
if(playercash > 0) {
GivePlayerMoney(killerid, playercash);
}
}

if(playercash > 0)
{
ResetPlayerMoney(playerid);
}
}
if(GetPlayerInterior(killerid) == (CP_BANK)
{
SetPlayerPos(killerid, 264.6288,77.5742,1001.0391);
}

return 1;
}
[/code]


The JB_SetPlayerPos, is from the Junkbuster anticheat.
Reply
#9

what is this function ?
Код:
S_OnPlayerDeath(killerid);
and that code is wrong
Код:
if(GetPlayerInterior(killerid) == (CP_BANK)
that GetPlayerInterior-Function returns the id of the Interior and not a name or something else

so search for the interior id ..
and then check if it is equal to
Код:
GetPlayerInterior(killerid);
Reply
#10

S_Onplayerdeath, its from Sandra's Rank system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)