Cуdigos Ъteis #1
#81

pawn Код:
#define GetNick(%0) GetPlayerName(%0, Nome, 24)
new Nome[24];
Para usar:
pawn Код:
new string[100];
format(string, sizeof(string),"O Nick dele й:%s", GetNick(playerid));
print(string);
#drakinsentranomsnparameensinarestenegocio'0x'
#Obg.
Reply
#82

pawn Код:
#include <a_samp>

#define FILTERSCRIPT
#define DIALOG_ANIMES 1547

public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/Animes", true) == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_ANIMES, DIALOG_STYLE_LIST, "Animes:", "Ficar De 4 \nRape\nFuder-Se\nObservar\nFicar Bebado\nAbaixar-Se\nAgaixar\nVomitar\nFumar\nFumar Baseado\nSentar\nRender-Se\nPegar Telefone\nGuardar Telefone\nPlantar Bomba\nConvercar", "Aplicar", "Cancelar");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ANIMES)
    {
        if(response)
        {
            if(listitem == 0)
            {
                ApplyAnimation  ( playerid , "FINALE" , "FIN_Land_Car" , 4.1 , 0 , 1 , 1 , 1 , 1  )   ;
            }
            if(listitem == 1)
            {
                ApplyAnimation  ( playerid ,  "ON_LOOKERS" ,  "wave_loop" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 2)
            {
                ApplyAnimation  ( playerid ,  "PED" ,  "fucku" ,  4.0 ,  0 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 3)
            {
                ApplyAnimation  ( playerid ,  "BAR" ,  "dnk_stndF_loop" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 4)
            {
                ApplyAnimation  ( playerid ,  "PED" ,  "WALK_DRUNK" ,  4.0 ,  1 ,  1 ,  1 ,  1 ,  0  )   ;
            }
            if(listitem == 5)
            {
                ApplyAnimation  ( playerid ,  "BEACH" ,  "bather" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 6)
            {
                ApplyAnimation  ( playerid ,  "ped" ,  "cower" ,  3.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 7)
            {
                ApplyAnimation  ( playerid ,  "FOOD" ,  "EAT_Vomit_P" ,  3.0 ,  0 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 8)
            {
                ApplyAnimation  ( playerid ,  "SMOKING" ,  "M_smklean_loop" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 9)
            {
                ApplyAnimation  ( playerid ,  "SMOKING" ,  "F_smklean_loop" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 10)
            {
                ApplyAnimation  ( playerid ,  "BEACH" ,  "ParkSit_M_loop" ,  4.0 ,  1 ,  0 ,  0 ,  0 ,  0  )   ;
            }
            if(listitem == 11)
            {
                SetPlayerSpecialAction(playerid, 10);
            }
            if(listitem == 12)
            {
                SetPlayerSpecialAction(playerid, 11);
            }
            if(listitem == 13)
            {
                ClearAnimations(playerid);
                ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            }
            if(listitem == 14)
            {
                ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.0, 0, 0, 0, 0, 0);
            }
        }
    }
    return 1;
    }
Alguns Animes Em Dialog...(Sem nada pra fazer -q Fato)...
Reply
#83

Sistema de mortes
pawn Код:
// Topo
new Matou[MAX_PLAYERS];

public
    OnPlayerDeath(playerid, killerid, reason)    
{
    static Nome[24], string[128];GetPlayerName(killerid, Nome, 24);
    if(Matou[killerid] == 5)  format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Rбpido, Matem ele logo !",Nome, playerid, Matou);
    if(Matou[killerid] == 10) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Hmm, Aprendeu direitinho hйin",Nome, playerid, Matou);
    if(Matou[killerid] == 20) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d Pessoas, este ta virando Foda!",Nome, playerid, Matou);
    if(Matou[killerid] == 20) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Espero que continue assim.",Nome, playerid, Matou);
    if(Matou[killerid] == 30) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, nгo quero ver %s tгo cedo!",Nome, playerid, Matou);
    if(Matou[killerid] == 40) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Este й matador de aluguel!",Nome, playerid, Matou);
    if(Matou[killerid] == 50) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Este concerteza nгo irб para o cйu!!",Nome, playerid, Matou);
    if(Matou[killerid] == 60) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Este fez Pбcto com demo!!",Nome, playerid, Matou);
    if(Matou[killerid] == 70) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Putz, no dia do apocalipse entгo ...",Nome, playerid, Matou);
    if(Matou[killerid] == 100) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Que Isto meu!",Nome, playerid, Matou);
    if(Matou[killerid] > 100 ) format(string, sizeof(string),"[INFO]: %s[ID:%i] Jб matou %d, Simplismente, o Melhor!!!",Nome, playerid, Matou);
   
        return  SendClientMessageToAll(Laranja, string),Matou[killerid]++, true;
}
Reply
#84

oq este cуdigo faz ?

pawn Код:
if(strcmp(cmdtext,"/strlen", true)) return printf("%s  Este comando tem%d caracteres.", cmdtext, strlen(cmdtext));
Reply
#85

MMC, MDC, Porcentagem
Pedido de um membro do fуrum PT/BR.
  • MDC
    Mбximo Divisor Comum entre 2 nъmeros inteiros
Код:
stock MDC(a,b)
if(b == 0) return a; else return MDC(b,a%b);
Ou (Base em Algoritmo de Euclides):
Код:
stock MDC(a, b)
{
	while (a != 0 && b != 0)
	if (a > b) a %= b;
	else b %= a; if (a == 0) return b;
	else return a;
}
Teste:
Код:
printf( "%d" ,MDC(12,20) ); //4
printf( "%d" ,MDC(20,24) ); //4
printf( "%d" ,MDC(6,12) ); //6
  • MMC
    Mнnimo Mъltiplo Comum entre 2 nъmeros inteiros
Код:
stock MMC(a,b)
return (a*b/MDC(a,b));
Teste:
Код:
printf( "%d" ,MMC(4,6) ); //12
printf( "%d" ,MMC(4,15) ); //60
printf( "%d" ,MMC(6,12) ); //12
  • Porcentagem
    Calculo de porcentagem de um nъmero inteiro especifico
Код:
Apenas resultados em valores Inteiros:
#define P(%0,%1) (%0*%1)/100

Apenas resultado em valores Interios + Decimais (Float):
#define P(%0,%1) (%0.0*%1.0)/100.0
Teste:
Код:
printf( "%d" , P(10,100) ); //10 porcento de 100 = 10
printf( "%d" , P(15,100) ); //15 porcento de 100 = 15
printf( "%d" , P(50,10) ); //50 porcento de 10 = 5
Reply
#86

Muito Simples. enveis de vocк colocar Todos os dados do AddPlayerClass, vocк sу coloca o Skin:
pawn Код:
#define AddClass(%0) ((AddPlayerClass(%0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0)))

Uso
pawn Код:
public OnGameModeInit()
{
      AddClass(0); // CJ
      return 1;
}
PS: Testado.

daquiapouco tou fazendo uma userful!
Reply
#87

Simples contagem para corridas.
como muitos criam vбrios SetTimer's, este cуdigo usa somente 1 settimer.

pawn Код:
#include a_samp

#define StartCount(%0) ContTemp=SetTimer("CountDown", 1000, true), Count = %0, tacontano=true

new Count = 0, ContTemp = 0, bool:tacontano,string[128];
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/contar", true))
    {
        return StartCount(5), true;
    }
    return false;
}
public OnFilterScriptInit()
{
    Count = 5;
    CountDown();
    return true;
}
forward CountDown();
public CountDown()
{
    if(tacontano == true) return 1;
    if(Count == 0) return GameTextForAll("Go Go Go]", 1000, 3),printf("Zirol"), KillTimer(ContTemp), Count = 5;
    format(string, sizeof(string),"%d", Count);
    GameTextForAll(string,5000,3);
    printf(string);
    SoundForAll(1056);
    return Count--;
}
stock SoundForAll(sonid)
{
    for(new i; i < MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i))
        {
            PlayerPlaySound(i,sonid,0,0,0);
        }
    }
}

fiz em forma de FS.
Reply
#88

Alguns animes que tirei do meu gm ...

pawn Код:
if(!strcmp(cmdtext,"/dancar1",true))
    {
        TextDrawShowForPlayer(playerid, TAnime);SetPlayerSpecialAction (playerid, SPECIAL_ACTION_DANCE1);
        return true;
    }
    if(!strcmp(cmdtext,"/dancar2",true))
    {
        TextDrawShowForPlayer(playerid, TAnime);SetPlayerSpecialAction (playerid, SPECIAL_ACTION_DANCE2);
        return true;
    }
    if(!strcmp(cmdtext,"/dancar3",true))
    {
        TextDrawShowForPlayer(playerid, TAnime);SetPlayerSpecialAction (playerid, SPECIAL_ACTION_DANCE3);
        return true;
    }
    if(!strcmp(cmdtext,"/dancar4",true))
    {
        TextDrawShowForPlayer(playerid, TAnime);SetPlayerSpecialAction (playerid, SPECIAL_ACTION_DANCE4);
        return true;
    }
    if(!strcmp(cmdtext,"/p",true))
    {
        ClearAnimations(playerid);
        return true;
    }
    if(!strcmp(cmdtext,"/roubar",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp(cmdtext,"/masturb",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"PAULNMAC", "wank_loop", 1.800001, 1, 0, 0, 1, 600);
        return true;
    }
    if(!strcmp(cmdtext,"/renderse",true))
    {
        TextDrawShowForPlayer(playerid, TAnime);SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        return true;
    }
    if(!strcmp(cmdtext,"/tchau",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "ON_LOOKERS", "wave_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp(cmdtext,"/saltopiscina",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"DAM_JUMP","DAM_LAUNCH",2,0,1,1,0,0);
        return true;
    }
    if(!strcmp(cmdtext,"/taichi",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"PARK","Tai_Chi_Loop",4.0,1,0,0,0,0);
        return true;
    }
    if(!strcmp(cmdtext,"/sentar",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"INT_OFFICE", "OFF_Sit_Bored_Loop", 1.800001, 1, 0, 0, 1, 600);
        return true;
    }
    if(!strcmp(cmdtext,"/boxear",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox", 1.800001, 1, 0, 0, 1, 600);
        return true;
    }
    if(!strcmp(cmdtext,"/tapinha",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "SWEET", "sweet_ass_slap", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp(cmdtext,"/rolar",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid,"PED","Crouch_Roll_L",4.1,0,1,1,1,1);
        return true;
    }
    if(!strcmp(cmdtext,"/pipi",true))
    {
        TextDrawShowForPlayer(playerid, TAnime); SetPlayerSpecialAction(playerid, 68);
        return true;
    }
    if(!strcmp(cmdtext,"/fone",true))
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE); TextDrawShowForPlayer(playerid, TAnime);
        return true;
    }
    if(!strcmp("/bebado",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "PED", "WALK_DRUNK", 4.0, 1, 1, 1, 1, 0);
        return true;
    }
    if(!strcmp("/bomba",cmdtext, true))
    {
        ClearAnimations(playerid);
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/apontar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1);
        return true;
    }
    if(!strcmp("/merda",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/mascararse",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/cruzarb",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1);
        return true;
    }
    if(!strcmp("/deitar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "BEACH", "bather", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/abaixar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/vomitar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/comer",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/rap",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "ON_LOOKERS", "wave_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/cobrar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "DEALER", "DEALER_DEAL", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/overdose",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/fumar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/fumar2",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "SMOKING", "F_smklean_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/sentar2",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/conversar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/saifora",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "PED", "fucku", 4.0, 0, 0, 0, 0, 0);
        return true;
    }
    if(!strcmp("/observar",cmdtext, true))
    {
        TextDrawShowForPlayer(playerid, TAnime); ApplyAnimation(playerid, "BAR", "dnk_stndF_loop", 4.0, 1, 0, 0, 0, 0);
        return true;
    }
Reply
#89

Enviar mensagem para um determinado nome em vez de playerid

pawn Код:
forward SendClientMessageEx(const NomeJogador[], cor, const mesagem[]);
public SendClientMessageEx(const NomeJogador[], cor, const mesagem[])
{
    new i;
    for(i=0;i<MAX_PLAYERS;i++)
    {
        new NomePlayer2[MAX_PLAYER_NAME];
        GetPlayerName(i,NomePlayer2,sizeof(NomePlayer2));
        if(!strcmp(NomePlayer2, NomeJogador, true, sizeof(NomePlayer2)))
        {
            SendClientMessage(i, cor, mesagem);
            return 1;
        }
    }
    return 0;
}
Exemplo

pawn Код:
SendClientMessageEx("DJloko", 0x33CCFFAA, "Olб!");
Reply
#90

@roginho

Esse nгo й um tуpico para discussхes, apenas cуdigos. Flame -> out.

__________________________________________________ ____________

Cуdigo de pName que retorna o nome do player com o Underline, ou com um espaзo, ao invйs.

PHP код:
stock pNameplayerid togglespace )
{
    new 
str[25], index;
    
GetPlayerNameplayerid str 24 );
    if( 
togglespace )
    {
        
index strfindstr "_" false );
        
str[index] = 32;
        return 
str;
    }
    else
    {
        return 
str;
    }


Reply
#91

Tenho Um codigo Util ele Faz que apenas o nome citado pode dar administrador pelo menos no meu gamemode funcionol

pawn Код:
if(strcmp(cmd, "/daradmin", true) ==0 )
    {
     GetPlayerName(playerid, sendername, 256);
        if(strcmp(sendername,"Nome_Autorizado",true)==0||strcmp(sendername,"Nome_Autorizado",true)==0||strcmp(sendername,"Nome_Autorizado",true)==0)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /daradmin [ id ] [level(1-5000)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            GetPlayerName(playerid, sendername, 256);
    {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("ADMIN CMD: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   Voce promoveu o(a) %s Para o level %d de Admin.", giveplayer,level);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   Voce foi promovido para level %d de Admin Por %s", level, sendername);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        new year, month,day;
                        getdate(year, month, day);
                        new hour, minute;
                        gettime(hour,minute);
                        format(string, sizeof(string), "%s Promoveu %s a adm level %d ( %d/%d/%d - %d:%d)",sendername,giveplayer,level,year, month, day,hour, minute);
                        AdminsLog(string);
                    }
                }
                SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nao й  Admin dono Para Usar Esse Cmd!");
            }
        }
        return 1;
    }
Reply
#92

#vamos parando de julgar o outro, isso й feio e tambйm parem de comer bala de caramelo, isso afeta o cйlebro.


Simples agregador de teleporte(falei bonito agora )

pawn Код:
stock CreateTele(playerid, nametele[],cmdtele[])// By: Garfield[iPs][Nick][lol][:D]
{
    if(!IsPlayerGay(playerid)) return false;
    static Nome[24], string[100];
    #define GetNick(%0)  ((GetPlayerName(%0, Nome, 24)))
    format(string, sizeof(string),"[INFO]: %s[ID:%i] foi para %s, ( %s )",GetNick(playerid), playerid, nametele,cmdtele);
    SendClientMessageToAll(0xFF00FFAA,string);
    format(string, sizeof(string),"Seja bem Vindo a %s", nametele);
    return GameTextForPlayer(playerid, string, 3000, 0), true;
}

Como usar
pawn Код:
if(!strcmp(cmdtext,"/drag", true))
{
        CreateTele(playerid, "Drag",cmdtext)
        return true;
}
Out (saida)
[INFO]: [iPs]Garfield[ID:0] foi para Drag, ( /Drag )
(GameTextForPlayer)Bem Vindo a Drag
Reply
#93

isPlayerFloding

pawn Код:
new gatoh[MAX_PLAYER];

public OnPlayerCommandText(playerid, text[])
{
         gatoh = GetTickCount();
         if(GetTickCount() < gatoh) return print("No Flooders"), false);
         return false;
}

Esta funзгo checa se o player fez flood ou nгo.
Reply
#94

pawn Код:
#define GetPlayerRating(%0) ((GetPlayerHealtH(playerid,Gato)/GetPlayerHealtH(playerid,Gato))
new Float:Gato;
Simples funзгo que pega a relaзгo do player ...
Reply
#95

pawn Код:
public OnPlayerText(playerid, text[])
{
    new chatstr[MAX_CHATBUBBLE_LENGTH+1];
    format(chatstr, sizeof(chatstr), "%s", text);
    SetPlayerChatBubble(playerid, chatstr, 0x1E90AAFA, 70.0,10000);
    return 1;
}
Texto digitado acima do player.
conhecido como ChatBubble.
Reply
#96

vamos estudar a tabuada! \o/
pawn Код:
stock Tabuada(iu)
{
          static iN = 1;
          while(iNuber > 10) iNuber = ((iN * iu)?(printf("%dx%d=%d",iu,iN,iu*In);):(false)) iNuber++/
          return true;
}
Reply
#97

Esta funзгo verifica se o jogador estб na бgua (seja em que parte do jogo fфr, desde que esteja na бgua):
pawn Код:
stock NaAgua(playerid)
{
   new Float:pX, Float:pY, Float:pZ;
   GetPlayerPos(playerid, pX,pY,pZ);
   if(pZ <= -1) Verifica se a posiзгo Z й negativa
   return SendClientMessage(playerid, 0xFFF000AA, "Vocк estб na Бgua!"), true;

   return false;
}
Podem alterar a mensagem para outras coisas que queiram que aconteзa se o jogador estiver na бgua, isso estб а vossa escolha.

Crйditos: LuxurioN
Reply
#98

pawn Код:
#define AllPlayers(%0) ((do{new %0; for(new %0; %0 < MAX_PLAYERS; ++%0) while(0)
Como usar:

pawn Код:
if(IsPlayerConnected(AllPlayers(i)))
{
         new string[100], Nome[24];
         format(string, sizeof(string),"-%s Acabou de entrar",GetPlayerName(playerid, Nome, 24));
         SendClientMessage(i, 0x0000, string);
}
Reply
#99

Calculadora
Uma calculadora em forma de comando.
(usando zcmd & sscanf)

pawn Код:
CMD:calcular(playerid, params[])
{
    new digito1, calculo[2], digito2;
    if(sscanf(params, "dsd", digito1, calculo, digito2))return SendClientMessage(playerid, 0xFFFFFFFF, "USE: '/calcular [digito1] [calculo] [digito2]'");
    new string[128];
    //Divisгo
    if(strcmp(calculo,"/",true) == 0)
    {
        format(string, sizeof(string), "Vocк dividiu {1E90FF}%d{FFFFFF} por {1E90FF}%d{FFFFFF} Resultado:{E31919} %d", digito1, digito2, digito1/digito2);
        SendClientMessage(playerid, -1, string);
    }
    //Multiplicaзгo
    else if(strcmp(calculo,"*",true) == 0)
    {
        format(string, sizeof(string), "Vocк multiplicou {1E90FF}%d{FFFFFF} por {1E90FF}%d{FFFFFF} Resultado:{E31919} %d", digito1, digito2, digito1*digito2);
        SendClientMessage(playerid, -1, string);
    }
    //Subtraзгo
    else if(strcmp(calculo,"-",true) == 0)
    {
        format(string, sizeof(string), "Vocк subtraiu {1E90FF}%d{FFFFFF} de {1E90FF}%d{FFFFFF} Resultado:{E31919} %d", digito1, digito2, digito1-digito2);
        SendClientMessage(playerid, -1, string);
    }
    //Adiзгo
    else if(strcmp(calculo,"+",true) == 0)
    {
        format(string, sizeof(string), "Vocк somou {1E90FF}%d{FFFFFF} mais {1E90FF}%d{FFFFFF} Resultado:{E31919} %d", digito1, digito2, digito1+digito2);
        SendClientMessage(playerid, -1, string);
    }
    else SendClientMessage(playerid, -1, "Sinal invбlido. [/,*,+ ou -]");
    return 1;
}
http://pastebin.com/XGSGZFcb

Resultado:
Reply

pawn Код:
#define END 0.0
#define SLOT 1
// /\ Inicio do GM
//*********************OnPlayerCommandText******************
        if (strcmp("/colocarcapacete", cmdtext, true, 10) == 0)
        {
        if(IsABike(GetPlayerVehicleID(playerid)))
        {
            switch(GetPlayerSkin(playerid))
            {
                #define SPAO{%0,%1,%2,%3,%4,%5} SetPlayerAttachedObject(playerid, SLOT, 18645, 2, (%0), (%1), (%2), (%3), (%4), (%5));
                case 0, 65, 74, 149, 208, 273:  SPAO{0.070000, 0.000000, 0.000000, 88.000000, 75.000000, 0.000000}
                case 1..6, 8, 14, 16, 22, 27, 29, 33, 41..49, 82..84, 86, 87, 119, 289: SPAO{0.070000, 0.000000, 0.000000, 88.000000, 77.000000, 0.000000}
                case 7, 10: SPAO{0.090000, 0.019999, 0.000000, 88.000000, 90.000000, 0.000000}
                case 9: SPAO{0.059999, 0.019999, 0.000000, 88.000000, 90.000000, 0.000000}
                case 11..13: SPAO{0.070000, 0.019999, 0.000000, 88.000000, 90.000000, 0.000000}
                case 15: SPAO{0.059999, 0.000000, 0.000000, 88.000000, 82.000000, 0.000000}
                case 17..21: SPAO{0.059999, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 23..26, 28, 30..32, 34..39, 57, 58, 98, 99, 104..118, 120..131: SPAO{0.079999, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 40: SPAO{0.050000, 0.009999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 50, 100..103, 148, 150..189, 222: SPAO{0.070000, 0.009999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 51..54: SPAO{0.100000, 0.009999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 55, 56, 63, 64, 66..73, 75, 76, 78..81, 133..143, 147, 190..207, 209..219, 221, 247..272, 274..288, 290..293: SPAO{0.070000, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 59..62: SPAO{0.079999, 0.029999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 77: SPAO{0.059999, 0.019999, 0.000000, 87.000000, 82.000000, 0.000000}
                case 85, 88, 89: SPAO{0.070000, 0.039999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 90..97: SPAO{0.050000, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 132: SPAO{0.000000, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 144..146: SPAO{0.090000, 0.000000, 0.000000, 88.000000, 82.000000, 0.000000}
                case 220: SPAO{0.029999, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 223, 246: SPAO{0.070000, 0.050000, 0.000000, 88.000000, 82.000000, 0.000000}
                case 224..245: SPAO{0.070000, 0.029999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 294: SPAO{0.070000, 0.019999, 0.000000, 91.000000, 84.000000, 0.000000}
                case 295: SPAO{0.050000, 0.019998, 0.000000, 86.000000, 82.000000, 0.000000}
                case 296..298: SPAO{0.064999, 0.009999, 0.000000, 88.000000, 82.000000, 0.000000}
                case 299: SPAO{0.064998, 0.019999, 0.000000, 88.000000, 82.000000, 0.000000}
            }
        }
        else return SendClientMessage(playerid, 0xFF4040AA, "Vocк nгo estб em uma moto.");
        return 1;
        }
//***********Fim do Game Mode**********
stock IsABike(vehicleid) //Made by me :D
{
    new result;
    new model = GetVehicleModel(vehicleid);
    switch(model)
    {
        case 509, 481, 510, 462, 448, 581, 522, 461, 521, 523, 463, 586, 468, 471: result = model;
        default: result = 0;
    }
    return result;
}
Larceny
Shaushau, й, realmente existe inumeras maneiras de otimizar aquele cуdigo, pensei em fazer por zcmd, dcmd, pensei em usar stock, pensei em usar publics enfim, й um cуdigo bem otimizavel, gostei da sua versгo em zcmd, parabйns ficou уtimo =D

Crйditos:
(Comando: Hiddos)
(Stock IsBike: Desconhecido.)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)