SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Español/Spanish > Lanzamientos/Releases

 
 
Thread Tools Display Modes
Old 28/02/2010, 04:02 PM   #1
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default [Funciones] Postea tus funciones aqui!

Hola, he abierto este post para que puedan postear funciones ya sean de mucha utilidad o de poca. Todas se aceptan, pueden ser propias o no, en caso de no ser propias agregar los creditos .


Empezare:

pawn Code:
GetPlayerPosEx(playerid, &Float:X, &Float:Y, &Float:Z, &Float:A)
{
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A);
}

SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:A)
{
  SetPlayerPos(playerid, X, Y, Z);
  SetPlayerFacingAngle(playerid, A);
}
__________________
Sometimes I return.
MrDeath537 is offline  
Old 28/02/2010, 11:38 PM   #2
CristianTdj
High-roller
 
CristianTdj's Avatar
 
Join Date: Jul 2009
Location: Andalucía, Spain.
Posts: 1,307
Reputation: 5
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

No entendí bien, ¿se ponen acciones o solo localizaciones?
__________________

CristianTdj is offline  
Old 01/03/2010, 10:10 AM   #3
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Se pone cualquier funcion, strtok, strrest, y otras... Yo puse esa
__________________
Sometimes I return.
MrDeath537 is offline  
Old 01/03/2010, 11:06 AM   #4
CristianTdj
High-roller
 
CristianTdj's Avatar
 
Join Date: Jul 2009
Location: Andalucía, Spain.
Posts: 1,307
Reputation: 5
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

pawn Code:
//AFk

  if(!strcmp(cmdtext, "/afk", true))
  {
    new pName[MAX_PLAYER_NAME];
    new string[48];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "Ahora estás AFK. Escribe /Volver para volver a tu estado normal.");
    SendClientMessage(0xFFFF00FF, string);
    format(string, sizeof(string), "%s está AFK.", pName);
    SendClientMessageToAll(0xFFFF00FF, string);
    TogglePlayerControllable(playerid,0);
    SetPlayerHealth(playerid,99999999999);  
    return 1;
  }

  if(!strcmp(cmdtext, "/volver", true))
  {
    new pName[MAX_PLAYER_NAME];
    new string[48];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "Has vuelto a tu estado normal.");
    SendClientMessage(0xFFFF00FF, string);
    format(string, sizeof(string), "%s ha vuelto.", pName);
    SendClientMessageToAll(0xFFFF00FF, string);
    TogglePlayerControllable(playerid,1);
    SetPlayerHealth(playerid,100);
    return 1;
  }
__________________

CristianTdj is offline  
Old 01/03/2010, 12:10 PM   #5
TheChaoz
High-roller
 
TheChaoz's Avatar
 
Join Date: Dec 2009
Location: Argentina
Posts: 4,649
Reputation: 239
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Quote:
Originally Posted by CristianTdj
pawn Code:
//AFk

  if(!strcmp(cmdtext, "/afk", true))
  {
    new pName[MAX_PLAYER_NAME];
    new string[48];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "Ahora estás AFK. Escribe /Volver para volver a tu estado normal.");
    SendClientMessage(0xFFFF00FF, string);
    format(string, sizeof(string), "%s está AFK.", pName);
    SendClientMessageToAll(0xFFFF00FF, string);
    TogglePlayerControllable(playerid,0);
    SetPlayerHealth(playerid,99999999999);  
    return 1;
  }

  if(!strcmp(cmdtext, "/volver", true))
  {
    new pName[MAX_PLAYER_NAME];
    new string[48];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "Has vuelto a tu estado normal.");
    SendClientMessage(0xFFFF00FF, string);
    format(string, sizeof(string), "%s ha vuelto.", pName);
    SendClientMessageToAll(0xFFFF00FF, string);
    TogglePlayerControllable(playerid,1);
    SetPlayerHealth(playerid,100);
    return 1;
  }
eso creo que es un comando mas que una funcion en si o no?
__________________
TheChaoz is offline  
Old 01/03/2010, 12:43 PM   #6
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Si bueno pero no importa XD, posteen comandos y funciones...
__________________
Sometimes I return.
MrDeath537 is offline  
Old 01/03/2010, 02:45 PM   #7
camiloasc1
Big Clucker
 
Join Date: Nov 2009
Posts: 73
Reputation: 3
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Pongo unas funciones que cree:

pawn Code:
stock TeleportPlayer(playerid, Float:x,Float:y,Float:z,interior,mundo)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      new vid = GetPlayerVehicleID(playerid);
        SetVehiclePos(vid,x,y,z);
        LinkVehicleToInterior(vid, interior);
        SetVehicleVirtualWorld(vid, mundo);
    } else {
        SetPlayerPos(playerid,x,y,z);
    }
    SetPlayerInterior(playerid,interior);
    SetPlayerVirtualWorld(playerid,mundo);
}

Antiflood de ips

La funcion de is numeric y el split no son mias pero sin esas no funciona

pawn Code:
forward split(const strsrc[], strdest[][], delimiter);

stock BuscarIPs(mensaje[])
{
    new encontrados;
    new Parte[30][64];
    split(mensaje, Parte, '.');
    for(new i = 1; i < 5; i++)
    {
        if(IsNumeric(Parte[i]))
        {
          encontrados ++;
        }
    }
    if(encontrados >= 2)
    {
        return 1;
    }
    return 0;
}

stock IsNumeric(const string[])
{
 new length=strlen(string);
 if (length==0) return false;
 for (new i = 0; i < length; i++)
  {
   if (
      (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
       || (string[i]=='-' && i!=0)                       // A '-' but not at first.
       || (string[i]=='+' && i!=0)                       // A '+' but not at first.
     ) return false;
  }
 if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
 return true;
}

public split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
      if(strsrc[i]==delimiter || i==strlen(strsrc))
        {
        len = strmid(strdest[aNum], strsrc, li, i, 128);
        strdest[aNum][len] = 0;
        li = i+1;
        aNum++;
        }
        i++;
    }
    return 1;
}

ejemplo:
pawn Code:
public OnPlayerText(playerid, text[])
{
    if(BuscarIPs(text))
    {
        SendClientMessage(playerid,COLOR_WHITE, "* No envies ip");
        return 0;
    }
}
__________________
camiloasc1 is offline  
Old 01/03/2010, 03:51 PM   #8
Zamaroht
Gangsta
 
Zamaroht's Avatar
 
Join Date: Jan 2007
Location: Argentina
Posts: 900
Reputation: 71
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Muy buena idea este topic, sale sticky.
Le saco el Off-Topic ya que en realidad está totalmente relacionado con SA-MP :P
__________________
Zamaroht is offline  
Old 01/03/2010, 04:00 PM   #9
Chiri
Big Clucker
 
Join Date: Dec 2009
Posts: 60
Reputation: 2
Default Re: [Funciones] Postea tus funciones aqui!

pawn Code:
public ReturnName(playerid) //
{
    new PlayerName[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        return PlayerName;
    }
    return 0;
}
Chiri is offline  
Old 01/03/2010, 07:54 PM   #10
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Re: [Off-topic - Funciones] Postea tus funciones aqui!

Quote:
Originally Posted by Zamaroht
Muy buena idea este topic, sale sticky.
Le saco el Off-Topic ya que en realidad está totalmente relacionado con SA-MP :P
Gracias , le habia puesto Off-topic por que como era ni FS, GM, INC... habia decidido poner asi jaja.
__________________
Sometimes I return.
MrDeath537 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ajuda aqui hitachi_uchila Português/Portuguese 2 04/03/2010 06:16 PM


All times are GMT. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.