SA-MP Forums Archive
[Pedido] Aзгo do personagem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Aзгo do personagem (/showthread.php?tid=638638)



Aзгo do personagem - zCyan - 03.08.2017

Galera eu preciso de um sistema desses rpg, quando vocк roubar, conversa etc, por exemplo

Code:
Nick_Teste estб tentando roubar o banco
Isso ai, eu procurei em um gm rpg atualizado, mais й uma gambiarra, ai eu falei, pode que o code esteja desatualizado, e como nгo sei otimizar esses tipos de codigos, queria pedir para vcs um desses. Obrigado


Re: Aзгo do personagem - ScripitrFaunu - 03.08.2017

Nгo entendi muito bem, vocк quer algo assim?

PHP Code:
CMD:fazeralgo(playerid)
{
    new 
string[128];
    
format(string, sizeof(string), "{FF7403}[Anuncio] {FFFFFF}O Player {FF7403}%s {FFFFFF}Esta Fazendo algo!", PlayerName(playerid));
    
SendClientMessageToAll(-1, string);
    return 
1;
} 
stock PlayerName
PHP Code:
 stock PlayerName(playerid)
{
    new 
aname[24];
    
GetPlayerName(playerid, aname, 24);
    return 
aname;
} 



Re: Aзгo do personagem - zCyan - 03.08.2017

Quote:
Originally Posted by ScripitrFaunu
View Post
Nгo entendi muito bem, vocк quer algo assim?

PHP Code:
CMD:fazeralgo(playerid)
{
    new 
string[128];
    
format(string, sizeof(string), "{FF7403}[Anuncio] {FFFFFF}O Player {FF7403}%s {FFFFFF}Esta Fazendo algo!", PlayerName(playerid));
    
SendClientMessageToAll(-1, string);
    return 
1;
} 
stock PlayerName
PHP Code:
 stock PlayerName(playerid)
{
    new 
aname[24];
    
GetPlayerName(playerid, aname, 24);
    return 
aname;
} 
Nгo mano, vou mandar um exemplo:

PHP Code:
            new string[128];
            
format(string, sizeof(string), "*** %s %s", sendername, result);
            
SendClientMessageInRange(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
Uma mensagem prуxima tlg?


Re: Aзгo do personagem - IlanZ - 03.08.2017

Tenta usar isso ai como base

PHP Code:
new string[128]; 
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result); 
for(new 
i; i < MAX_PLAYERS; i++)
{
    if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z))
    {
        
SendClientMessage(playerid, -1, string); 
    }
} 



Re: Aзгo do personagem - zCyan - 03.08.2017

Quote:
Originally Posted by IlanZ
View Post
Tenta usar isso ai como base

PHP Code:
new string[128]; 
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result); 
for(new 
i; i < MAX_PLAYERS; i++)
{
    if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z))
    {
        
SendClientMessage(playerid, -1, string); 
    }
} 
Como posso criar uma stock com isso ai? pra nгo ter que ficar criando isso ai em todos os codes


Re: Aзгo do personagem - Maxwilson01 - 04.08.2017

PHP Code:
stock(const string)
{
    
//new string[128];  
    
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result);  
    for(new 
i; i < MAX_PLAYERS; i++) 
    { 
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z)) 
        { 
        
SendClientMessage(playerid, -1, string);  
        } 
    }
  return 
true;
} 
Era isso?

Vocк pode usar desse jeito, com getMaxPlayers a diferenзa do Max_Players que vocк percorre todo os slots do servidor, jб o getMaxPlayers ele puxa o maximo de jogadores conectado.

PHP Code:

stock
(const string)
{
    
//new string[128];  
    
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result);  
    for(new 
i; i < GetMaxPlayers(); i++) 
    { 
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z)) 
        { 
        
SendClientMessage(playerid, -1, string);  
        } 
    } 
   return 
true;
} 



Re: Aзгo do personagem - LucasF - 04.08.2017

Quote:
Originally Posted by Maxwilson01
View Post
PHP Code:
stock(const string)
{
    
//new string[128];  
    
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result);  
    for(new 
i; i < MAX_PLAYERS; i++) 
    { 
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z)) 
        { 
        
SendClientMessage(playerid, -1, string);  
        } 
    }
  return 
true;
} 
Era isso?

Vocк pode usar desse jeito, com getMaxPlayers a diferenзa do Max_Players que vocк percorre todo os slots do servidor, jб o getMaxPlayers ele puxa o maximo de jogadores conectado.

PHP Code:

stock
(const string)
{
    
//new string[128];  
    
format(string, sizeof(string), "*** %s estб roubando a pqp", sendername, result);  
    for(new 
i; i < GetMaxPlayers(); i++) 
    { 
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 30.0, x,y,z)) 
        { 
        
SendClientMessage(playerid, -1, string);  
        } 
    } 
   return 
true;
} 
GetMaxPlayer й mais lento que MAX_PLAYERS, uma boa opзгo й usar GetPlayerPoolSize.


Re: Aзгo do personagem - IlanZ - 04.08.2017

PHP Code:
stock SendClientMessageInRange(playerid,Float:raio,const string[]) 
{    
    new 
Float:X,Float:Y,Float:Z;
    
GetPlayerPos(playerid, X,Y,Z);
    for(new 
i; i < MAX_PLAYERS+1; i++)  
    {  
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,raio, X,Y,Z))  
        {  
            
SendClientMessage(i, -1, string);   
        }  
    }  
   return 
true; 
} 
/* 
    Modo de uso:
    SendClientMessageInRange(playerid, RAIO, STRING);
    Exemplo: 
    SendClientMessageInRange(playerid, 10.0, "Ele estб dando o cu kkk");
    
*/ 
Nгo testei.


Re: Aзгo do personagem - Maxwilson01 - 04.08.2017

Quote:
Originally Posted by LucasF
View Post
GetMaxPlayer й mais lento que MAX_PLAYERS, uma boa opзгo й usar GetPlayerPoolSize.
Tendi, vou da uma estuda no GetPlayerPoolSize. hehe.


Re: Aзгo do personagem - GuilhermeNunes - 04.08.2017

Eu acho que entendi o cara ele quer dizer criar uma stock com mensagem preparadas que manda conforme o cara faz uma aзгo sem precisar ficar usando GETPLAYERNAME nos code ... mas eu n sei se й possivel...


Re: Aзгo do personagem - IlanZ - 04.08.2017

Lуgico que й, e й muito fбcil. Se ele quiser ele comenta dnv.


Re: Aзгo do personagem - zCyan - 04.08.2017

Quote:
Originally Posted by IlanZ
View Post
PHP Code:
stock SendClientMessageInRange(playerid,Float:raio,const string[]) 
{    
    new 
Float:X,Float:Y,Float:Z;
    
GetPlayerPos(playerid, X,Y,Z);
    for(new 
i; i < MAX_PLAYERS+1; i++)  
    {  
        if(
IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,raio, X,Y,Z))  
        {  
            
SendClientMessage(i, -1, string);   
        }  
    }  
   return 
true; 
} 
/* 
    Modo de uso:
    SendClientMessageInRange(playerid, RAIO, STRING);
    Exemplo: 
    SendClientMessageInRange(playerid, 10.0, "Ele estб dando o cu kkk");
    
*/ 
Nгo testei.
Vlw mano! Funcionou