● Información Adicional:Filescript de zombies básico, recomendado!
● Código:
//------------------------------------------------------------------------------
//
// Zombie Filter Script v1.2
// Designed for SA-MP v0.2.2
//
// Created by zeruel_angel
//
//------------------------------------------------------------------------------
#include <a_samp>
new currentObj[MAX_PLAYERS];
new zombie[6];
new Float:Zspeed = 5.0;
new vaiven = 6;
new ZTimerSpeed = 500;
new Float:X,Float:Y,Float:Z;
enum zombiParts
{
partModel,
Float:RelX,
Float:RelY,
Float:RelZ,
Float:RelrX,
Float:RelrY,
Float:RelrZ
}
new z1[6][zombiParts]=
{
{2905,-0.115479,-0.023924, -1.280131, -90.000000, 90.000000,0.000000},
{2906, -0.218995, 0.200928, -0.253135, 0.000000, 180.000000, 0.000000},
{2907, -0.032227, -0.045897, -0.544213, 270.000000, 0.000000, 0.000000},
{2906, 0.187987, 0.158448, -0.265793, 0.000000, 0.000000, 0.000000},
{2908, 0.000000, 0.000000, 0.000000, 270.000000, 90.000000, 0.000000},
{2905, 0.101074, -0.012694, -1.288253, 270.000000, 90.000000, 0.000000}
};
new z2[6][zombiParts]=
{
{2905, 0.005614, -0.110107, -1.280131, -90.000000, 90.000000, 90.000000},
{2906, -0.148926, -0.180663, -0.253135, 0.000000, 180.000000, 90.000000},
{2907, 0.047852, -0.039061, -0.544213, 270.000000, 0.000000, 90.000000},
{2906, -0.152343, 0.171387, -0.265793, 0.000000, 0.000000, 90.000000},
{2908, 0.000000, 0.000000, 0.000000, 270.000000, 90.000000, 90.000000},
{2905, 0.000977, 0.090332, -1.288253, 270.000000, 90.000000, 90.000000}
};
forward zombieAtaca(playerid);
new TimerAtaca=-1;
//------------------------------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print("\n ZOMBIE Filter Script v1.2 Loading...\n**********************\n (Zeruel_Angel)\n");
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnFilterScriptExit()
{
print("\n*********** ZOMBIE (zeruel_angel) ***********\n");
return 1;
}
//------------------------------------------------------------------------------------------------------
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//------------------------------------------------------------------------------------------------------
CrearZombie(Float:pX,Float:pY,Float:pZ,Float:angle)
{
new Float:PEPE = floatsin((angle*3.14159/180.0));
new Float:PIPO = floatcos((angle*3.14159/180.0));
for (new i=0;i<6;i++)
{
zombie[i]=CreateObject(z1[i][partModel],pX+z1[i][RelX]*PIPO+PEPE*z2[i][RelX],pY+z1[i][RelY]*PIPO+PEPE*z2[i][RelY],pZ+z1[i][RelZ],z1[i][RelrX],z1[i][RelrY],angle);
}
return zombie[4];
}
//------------------------------------------------------------------------------------------------------
ZombieLookPlayer(playerid)
{
new Float:pX,Float:pY,Float:pZ,Float:angle;
GetPlayerPos(playerid,pX,pY,pZ);
GetObjectPos(zombie[4],X,Y,Z);
angle = 180.0-atan2(X-pX,Y-pY);
printf("%f",angle);
for (new i=0;i<6;i++)
{
DestroyObject(zombie[i]);
}
new Float:ran = float(random(6))-3.0;
CrearZombie(X,Y,Z,angle+ran);
return zombie[4];
}
//------------------------------------------------------------------------------------------------------
public zombieAtaca(playerid)
{
new Float:pX,Float:pY,Float:pZ,Float:angle;
GetPlayerPos(playerid,pX,pY,pZ);
GetObjectPos(zombie[4],X,Y,Z);
angle = 180.0-atan2(X-pX,Y-pY);
new Float:ran = float(random(vaiven)-vaiven/2);
angle=angle+ran;
new Float:PEPE = floatsin((angle*3.14159/180.0));
new Float:PIPO = floatcos((angle*3.14159/180.0));
for (new i=0;i<6;i++)
{
DestroyObject(zombie[i]);
zombie[i]=CreateObject(z1[i][partModel],X+z1[i][RelX]*PIPO+PEPE*z2[i][RelX],Y+z1[i][RelY]*PIPO+PEPE*z2[i][RelY],Z+z1[i][RelZ],z1[i][RelrX],z1[i][RelrY],angle);
}
for (new i=0;i<6;i++)
{
MoveObject(zombie[i],pX+z1[i][RelX]*PIPO+PEPE*z2[i][RelX],pY+z1[i][RelY]*PIPO+PEPE*z2[i][RelY],pZ+z1[i][RelZ]+0.7,Zspeed);
}
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new tmp[255];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/zspeed", true)==0)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USE: /zspeed [velocidad]");
return 1;
}
Zspeed=floatstr(tmp);
return 1;
}
if (strcmp(cmd, "/vaiven", true)==0)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USE: /vaiven [angulo]");
return 1;
}
vaiven=strval(tmp);
return 1;
}
if (strcmp(cmd, "/ZTimerSpeed", true)==0)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USE: /ZTimerSpeed [timer speed]");
return 1;
}
ZTimerSpeed=strval(tmp);
OnPlayerCommandText(playerid, "/zstop");
OnPlayerCommandText(playerid, "/zstart");
return 1;
}
if (strcmp(cmd, "/zo", true)==0)
{
new Float:pX,Float:pY,Float:pZ,Float:Ang;
GetPlayerPos(playerid,pX,pY,pZ);
GetPlayerFacingAngle(playerid,Ang);
pX=pX+3.0*floatsin(-Ang,degrees);
pY=pY+3.0*floatcos(-Ang,degrees);
pZ=pZ+0.7;
currentObj[playerid]=CrearZombie(pX,pY,pZ,Ang+180.0);
format(tmp,sizeof(tmp),"The object ID is: %d",currentObj[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, tmp);
return 1;
}
if (strcmp(cmd, "/zlook", true)==0)
{
ZombieLookPlayer(playerid);
return 1;
}
if (strcmp(cmd, "/zstart", true)==0)
{
if (IsValidObject(zombie[4]))
{
if (TimerAtaca!=-1)
{
KillTimer(TimerAtaca);
}
TimerAtaca=SetTimerEx("zombieAtaca",ZTimerSpeed,1,"i",playerid);
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "There are no zombie");
return 1;
}
return 1;
}
if (strcmp(cmd, "/zstop", true)==0)
{
if (IsValidObject(zombie[4]))
{
if (TimerAtaca!=-1)
{
KillTimer(TimerAtaca);
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "There are no zombie");
return 1;
}
return 1;
}
return 0;
}
--> Pastebin: http://pastebin.com/f3385e7bc#