09.11.2017, 11:24
alguem consegue me passar um sistema de safe zone que eu queria proibir as armas em determinados locais.
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
SetPlayerArmedWeapon(playerid, 0);
new
safe_zone,
sabe_zone_timer;
new
Float:minx = 1248.011,
Float:miny = 2072.804,
Float:maxx = 1439.348,
Float:maxy = 2204.319;
public OnGameModeInit()
{
/*
minY
v
minX > *-------------
| |
| gangzone |
| center |
| |
-------------* < maxX
^
maxY
*/
safe_zone = GangZoneCreate(minx, miny, maxx, maxy);
return true;
}
public OnPlayerConnect(playerid)
{
sabe_zone_timer = SetTimerEx("OnPlayerEnterGangZone", 1000, true, "i", playerid);
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
#pragma unused reason
KillTimer(sabe_zone_timer);
return true;
}
forward OnPlayerEnterGangZone(playerid);
public OnPlayerEnterGangZone(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(x <= maxx && x >= minx && y <= maxy && y >= minx)
{
SetPlayerArmedWeapon(playerid, 0);
SendClientMessage(playerid, -1, "Vocк nгo pode usar armas nesta area.");
}
return;
}
GangZoneDestroy(safe_zone );
PHP код:
|
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
switch ( newkeys ){
case 128:{
if(GetPlayerWeapon(playerid) != 0)
if(Variavel_AreaProibida) {
SetPlayerArmedWeapon(playerid, 0);
ClearAnimations(playerid);
return GameTextForPlayer(playerid,"~r~Voce nao pode usar esta arma em arena proibida!", 5000, 1);
}
}
}
return 1;
}
new AreaProibida;
public OnGameModeInit(){
AreaProbida = CreateDynamicSphere(X,Y,Z, 10, -1, -1, -1);
return 1;
}
public OnPlayerEnterDynamicArea(playerid, areaid){
if(areaid == AreaProibida){
//Aqui a funзгo para tirar as armas
SetPlayerArmedWeapon(playerid, 0);
SendClientMessage(playerid, 0xFF00FFFF, "Esse local й Proibido o uso de armas!");
}
return 1;
}
AddPlayerClass(23,X,Y,Z |
AreaProbida = CreateDynamicSphere(X,Y,Z,10, -1, -1, -1 |