Raised This Month: $32 Target: $400
 8% 

Recopilación de códigos.


  
 
 
Thread Tools Display Modes
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 07-23-2013 , 15:32   Re: Recopilación de códigos.
#81

algunas funciones si. pero como dijo r0ma, metal y yo. LA DIFERENCIA ES MINIMA
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-23-2013 , 19:43   Re: Recopilación de códigos.
#82

Quote:
Originally Posted by DiegoCS View Post
no, que anda mas rapido engine...
Depende para qué y cómo lo uses.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 08-10-2013 , 23:18   Re: Recopilación de códigos.
#83

urlencode:
Code:
new const sHexTable[] = "0123456789abcdef" stock urlencode(const sString[], out[], len) {     new from, c     new to     new sResult[301]         while(from < len) {         c = sString[from++]         if(c == 0) {             sResult[to++] = c             break         }         else if(c == ' '){             sResult[to++] = '+'         }         else if((c < '0' && c != '-' && c != '.') ||         (c < 'A' && c > '9') ||         (c > 'Z' && c < 'a' && c != '_') ||         (c > 'z')) {             if((to + 4) > len) {                 sResult[to] = 0                 break             }             sResult[to++] = '%'             sResult[to++] = sHexTable[c >> 4]             sResult[to++] = sHexTable[c & 15]         }         else {             sResult[to++] = c         }     }     copy(out, len, sResult) }
stock de joropito
___________________________________


Separa los números de un string y los inserta en un array.
Code:
stock str_to_arraynum(sznum[], output[], len) {     new i, j, k, c, temp[6], end = strlen(sznum)         for(i = 0; i <= end; i++)     {         if(sznum[i] == ' ' || i == end)         {             output[j++] = str_to_num(temp)             for(c = 0; c < k; c++) temp[c] = 0;             k = 0         }         if(j > len) return j;         temp[k++] = sznum[i]     }     return j; }

e.g.
Code:
new szData[] = "5 1 2 1" new iValues[4] str_to_arraynum(szData, iValues, 3) // iValues[0] = 5 // iValues[1] = 1 // iValues[2] = 2 // iValues[3] = 1
___________________________________


Comprobar player valido en menu.
Code:
stock check_player_menu(szData[], &iPlayer) {     static szId[6], szUserid[8]     parse(szData, szId, 5, szUserid, 7)         iPlayer = str_to_num(szId)     if(is_user_connected(iPlayer) && get_user_userid(iPlayer) == str_to_num(szUserid))         return 1             return 0 }

e.g.
Code:
public show_menu_test(id) {     new name[32], data[11]     new menu = menu_create("Players:", "menu_test")     for(new i = 1; i <= g_maxplayers; i++)     {         if(!is_user_connected(i)) continue                 get_user_name(i, name, 31)         formatex(data, 10, "%d %d", i, get_user_userid(i))         menu_additem(menu, name, data)     }     menu_display(id, menu, 0) } public menu_test(id, menu, item) {     if(item == MENU_EXIT)     {         menu_destroy(menu)         return PLUGIN_HANDLED     }     new data[11], null[2]     menu_item_getinfo(menu, item, null[0], data, 10, null, 1, null[0])         new player     if(!check_player_menu(data, player))     {         client_print(id, print_chat, "player invalido :S")         menu_destroy(menu)         return PLUGIN_HANDLED     }         menu_destroy(menu)     return PLUGIN_HANDLED }
___________________________________



WaterLevel.
Code:
Float:UTIL_WaterLevel(const Float:position[3], Float:minz, Float:maxz) {     new Float:midUp[3]     midUp = position     midUp[2] = minz     if(point_contents(midUp) != CONTENTS_WATER)         return minz     midUp[2] = maxz     if(point_contents(midUp) == CONTENTS_WATER)         return maxz     new loop     new Float:diff = maxz - minz     while(diff > 1.0)     {         midUp[2] = minz + diff/2.0         if(point_contents(midUp) == CONTENTS_WATER)             minz = midUp[2]         else             maxz = midUp[2]         diff = maxz - minz         loop++     }     return midUp[2] }
__________________

Last edited by Destro-; 08-10-2013 at 23:48.
Destro- is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 08-18-2013 , 16:10   Re: Recopilación de códigos.
#84

Lol lo de sleep en pawn quítalo que ta mal xD

Client print chat con salto de linea
PHP Code:
stock client_print_chats(const id, const message[])
{
    static 
last=0toprint[1032]=""bool:found=falseb=0;
    new 
len=strlen(message)
    for(new 
i=0;i<=len;i++)
    {
        
//client_print(id, print_chat, "LOOP: %d", i)
        
if( message[i] == '^n' )
        {
            if(
i-last<=0)
                
toprint " "
            
else{
                
b=0
                
for(new a=last;a<=i;a++)
                {
                    
toprint[b]=message[a]
                    
b++
                }
            }
            
client_print(idprint_chattoprint)
            
found=true;
            
last=i+1;
        }
    }
    return 
found;

Uso
PHP Code:
client_print_chats(0"Hello^nAlliedmodders^n^n:)"
PD: Muchos ^n puede provocar reliable channel overflowed

Last edited by Stereo; 08-18-2013 at 18:02.
Stereo is offline
DiegoCS
Senior Member
Join Date: Mar 2013
Old 08-19-2013 , 03:45   Re: Recopilación de códigos.
#85

Quote:
Originally Posted by Stereo View Post
Lol lo de sleep en pawn quítalo que ta mal xD

Client print chat con salto de linea
PHP Code:
stock client_print_chats(const id, const message[])
{
    static 
last=0toprint[1032]=""bool:found=falseb=0;
    new 
len=strlen(message)
    for(new 
i=0;i<=len;i++)
    {
        
//client_print(id, print_chat, "LOOP: %d", i)
        
if( message[i] == '^n' )
        {
            if(
i-last<=0)
                
toprint " "
            
else{
                
b=0
                
for(new a=last;a<=i;a++)
                {
                    
toprint[b]=message[a]
                    
b++
                }
            }
            
client_print(idprint_chattoprint)
            
found=true;
            
last=i+1;
        }
    }
    return 
found;

Uso
PHP Code:
client_print_chats(0"Hello^nAlliedmodders^n^n:)"
PD: Muchos ^n puede provocar reliable channel overflowed
muy bueno.. me sirve .
DiegoCS is offline
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 08-20-2013 , 21:00   Re: Recopilación de códigos.
#86

Code:
num_to_base62(num, base=62, out[], maxoutlen) {     static baseindex[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"     new outlen, aux, aux2, aux3[32]         aux = num % base     aux3[outlen++] = baseindex[aux]         aux2 = floatround((num/62.0), floatround_floor)     while(aux2 && outlen <= maxoutlen)     {         aux = aux2 % base         aux2 = floatround((aux2/62.0), floatround_floor)         aux3[outlen++] = baseindex[aux]     }         for(new i; i < outlen; i++ )         out[i] = aux3[(outlen-1)-i] } to_base10(num[], b=62) {     static base[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"     new limit = strlen(num)     new res=strpos(base, num[0], b)         for(new i=1; i < limit; i++)     {         res = b * res + strpos(base, num[i], b)     }     return res } strpos(base[], caracter, len) {     for(new i; i <= len; i++)         if(base[i] == caracter) return i         return 0 }
__________________
Destro- is offline
 



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

Forum Jump


All times are GMT -4. The time now is 00:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode