Portal SAMP
Fixado: Códigos Úteis - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: Fixado: Códigos Úteis (/showthread.php?tid=73)

Páginas: 1 2 3 4 5


Códigos Úteis - sinux - 29/09/2020

[Códigos Utéis]

 
  •  Tópico destinado a postagem de códigos pequenos como de tutoriais ou filterscripts.
  •  Sempre que postar um código, coloque uma descrição no mesmo.
  •  Códigos devem ser postado com o embed [code], ou [php], para uma melhor organização.
  •  Sempre tente ser o mais breve possível e não repita mensagens de agradecimento ou script, edite sempre que puder.
  •  Por fim acho que é isso mesmo, obrigado!
    Em caso de edição do tópico, por favor me mande uma mensagem privada.
    Autor: sinux.


RE: Códigos Úteis - sinux - 29/09/2020

Proxdetector:
Código PHP:
forward ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5);
public 
ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
{
    new Float:posxFloat:posyFloat:posz;
    new Float:oldposxFloat:oldposyFloat:oldposz;
    new Float:tempposxFloat:tempposyFloat:tempposz;
    GetPlayerPos(playeridoldposxoldposyoldposz);
    for(new 0MAX_PLAYERSi++)
{
    if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
    GetPlayerPos(iposxposyposz);
    tempposx = (oldposx -posx);
    tempposy = (oldposy -posy);
    tempposz = (oldposz -posz);
    if (((tempposx radi/16) && (tempposx > -radi/16)) && ((tempposy radi/16) && (tempposy > -radi/16)) && ((tempposz <radi/16) && (tempposz > -radi/16)))
{
    SendClientMessage(icol1string);
}
    else if (((tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8)))
{
    SendClientMessage(icol2string);
}
    else if (((tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4)))
{
    SendClientMessage(icol3string);
}
    else if (((tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2)))
{
    SendClientMessage(icol4string);
}
    else if (((tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
{
    SendClientMessage(icol5string);
}
}
    else
{
    SendClientMessage(icol1string);
}
}
}
    return 1;


Getname:
Código PHP:
stock GetName(playerid)
{
    new
    name[24];
    GetPlayerName(playeridnamesizeof(name));
    strreplace(name'_'' ');
    return name;
}

stock strreplace(string[], findreplace)
{
    for(new i=0string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }



Cores:
Código PHP:
#define     COR_ME                  0xC2A2DAFF
#define     COR_B                   0xAFAFAFFF
#define     AMARELO                 0xFFF01FFF
#define     COR_PM                  0xF7F62CFF
#define     VERDE_ESCURO            0x018217FF
#define     COR_ANUNCIO             0x3CA03EFF
#define     VERMELHO                0xFF4A4AFF
#define     AZUL                    0x3C4EEFF
#define     ROXO                    0x333399FF
#define     COR_PELE                0xFFBF70FF
#define     COLOR_BITEM             0xE1B0B0FF
#define     COLOR_GRAD1             0xB4B5B7FF
#define     COLOR_GRAD2             0xBFC0C2FF
#define     COLOR_GRAD3             0xCBCCCEFF
#define     COLOR_GRAD4             0xD8D8D8FF
#define     COLOR_GRAD5             0xE3E3E3FF
#define     COLOR_GRAD6             0xF0F0F0FF
#define     COLOR_GREY              0xAFAFAFAA
#define     COLOR_GREEN             0x33AA33AA
#define     COLOR_RED                 0xFF4A4AFF
#define     COLOR_BLACK             0x000001FF
#define     COLOR_BLUE              0x007BD0FF
#define     COLOR_LIGHTORANGE       0xFFA100FF
#define     COLOR_FLASH             0xFF000080
#define     COLOR_LIGHTRED          0xFF6347AA
#define     COLOR_LIGHTBLUE         0x33CCFFAA
#define     COLOR_LIGHTGREEN        0x9ACD32AA
#define     COLOR_YELLOW            0xFFFF00AA
#define     COLOR_LIGHTYELLOW       0xFFFF91FF
#define     COLOR_YELLOW2           0xF5DEB3AA
#define     COLOR_WHITE             0xFFFFFFAA
#define     COLOR_FADE1             0xE6E6E6E6
#define     COLOR_FADE2             0xC8C8C8C8
#define     COLOR_FADE3             0xAAAAAAAA
#define     COLOR_FADE4             0x8C8C8C8C
#define     COLOR_FADE5             0x6E6E6E6E
#define     COLOR_PURPLE            0xC2A2DAAA
#define     COLOR_DBLUE             0x2641FEAA
#define     COLOR_DOC               0xFF8282AA
#define     COLOR_DCHAT             0xF0CC00FF
#define     COLOR_NEWS              0xFFA500AA
#define     COLOR_OOC               0xE0FFFFAA
#define     TEAM_BLUE_COLOR         0x8D8DFF00
#define     TEAM_GROVE_COLOR        0x00AA00FF
#define     TEAM_AZTECAS_COLOR      0x01FCFFC8
#define     NEWBIE_COLOR            0x7DAEFFFF
#define     SAMP_COLOR              0xAAC4E5FF

#define     EMBED_GREEN             "{1EFF00}"
#define     EMBED_RED                 "{FF0000}"
#define     EMBED_WHITE             "{FFFFFF}"
#define     EMBED_LIGHT_GREEN         "{50FF50}"
#define     EMBED_LIGHT_RED         "{FF5050}" 

Comandos roleplay:
Código PHP:
CMD:me(playeridparams[])
{
    if(isnull(params)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /me [acao] de forma certa!");
    new string[128];
    format(stringsizeof(string), "* %s %s"GetName(playerid), params);
    ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    return 1;


Comando /pagar da net :v
Código PHP:
CMD:pagar(playeridparams[])
{
    new idquantiastring[256], quemdeu[MAX_PLAYER_NAME], quemganhou[MAX_PLAYER_NAME];
    if(sscanf(params,"ii",id,quantia)) return SendClientMessage(playerid, -1"USE: /pagar [ID [QUANTIA]");
    GetPlayerName(idquemganhousizeof(quemganhou));
    GetPlayerName(playeridquemdeusizeof(quemdeu));
    GivePlayerMoney(idquantia);
    GivePlayerMoney(playerid, -quantia);
    format(stringsizeof(string), "Vocк Pagou R$ %d para %s(ID: %d)"quantiaquemganhouid);
    SendClientMessage(playeridCOLOR_GRAD1string);
    format(stringsizeof(string), "Vocк Ganhou R$ %d de %s(Jogador: %d)."quantiaquemdeuplayerid);
    SendClientMessage(idCOLOR_GRAD1string);
    return 1;



Código PHP:
CMD:ame(playeridparams[])
{
    if(isnull(params)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /ame [acao] de forma certa!");
    new string[128];
    format(stringsizeof(string), "> %s %s"GetName(playerid), params);
    SetPlayerChatBubble(playeridstringCOLOR_PURPLE20.03000);
    format(stringsizeof(string), "> %s %s"GetName(playerid), params);
    SendClientMessage(playeridCOLOR_PURPLEstring);
    return 1;


Código PHP:
CMD:baixo(playeridparams[])
{
    if(isnull(params)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /baixo [acao] de forma certa!");
    new string[128];
    format(stringsizeof(string), "[baixo] %s diz %s"GetName(playerid), params);
    ProxDetector(5.0playeridstringCOLOR_FADE1COLOR_FADE2COLOR_FADE3 ,COLOR_FADE4COLOR_FADE5);
    format(stringsizeof(string), "[baixo] %s"params);
    SetPlayerChatBubble(playeridstringCOLOR_WHITE5.05000);
    return 1;



Código PHP:
CMD:gritar(playerid,params[])
{
    new string[128];
    if(isnull(params)) return SendClientMessage(playeridVERMELHO,"{FF4A4A}USE:{FFFFFF} /gritar [grito] de forma certa!");
    format(stringsizeof(string), "%s grita: %s!"GetName(playerid), params);
    ProxDetector(30.0playeridstring,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2);
    return 1;



Código PHP:
CMD:ado(playeridparams[])
{
    if(isnull(params)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /do [ambiente] de forma certa!");
    new string[128];
    format(stringsizeof(string), "> %s (( %s ))"paramsGetName(playerid));
    SetPlayerChatBubble(playeridstringCOLOR_PURPLE20.03000);
    format(stringsizeof(string), "> %s (( %s ))"paramsGetName(playerid));
    SendClientMessage(playeridCOLOR_PURPLEstring);
    return 1;



Código PHP:
CMD:do(playeridparams[])
{
    if(isnull(params)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /do [ambiente] de forma certa!");
    new string[128];
    format(stringsizeof(string), "* %s (( %s ))"paramsGetName(playerid));
    ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    return 1;



Código PHP:
CMD:b(playeridparams[])
{
    new text[128], string[128];
    if(sscanf(params"s[128]"text)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /b [descrever] de forma certa!");
    format(stringsizeof(string), "(( [%d] %s: %s ))"playeridGetName(playerid), text);
    ProxMessage(playerid15.00xB3B3B3FFstring);
    return 1;


Código PHP:
CMD:pm(playeridparams[])
{
    new str[128], text[128], targetid;
    if(sscanf(params"us[128]"targetidtext)) return SendClientMessage(playeridVERMELHO"{FF4A4A}USE:{FFFFFF} /pm [player] [texto] de forma certa!");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playeridVERMELHO"{018217}SERVER:{FFFFFF} O jogador nao esta conectado!");
    format(strsizeof(str), "PM para %s (%d): %s"GetName(targetid), targetidtext);
    SendClientMessage(playerid0xE0E800FFstr);
    format(strsizeof(str), "PM de %s (%d): %s"GetName(playerid), playeridtext);
    SendClientMessage(targetid0xE8C900FFstr);
    return 1;




RE: Códigos Úteis - Smyle - 29/09/2020

Código:
stock ProxDetectorFade(playerid, Float:max_range, color, const string[], Float:max_ratio = 1.6)
{
    new
        Float:pos_x,
        Float:pos_y,
        Float:pos_z,
        Float:range,
        Float:range_ratio,
        Float:range_with_ratio,
        clr_r, clr_g, clr_b,
        Float:color_r, Float:color_g, Float:color_b;

    if (!GetPlayerPos(playerid, pos_x, pos_y, pos_z)) {
        return 0;
    }

    color_r = float(color >> 24 & 0xFF);
    color_g = float(color >> 16 & 0xFF);
    color_b = float(color >> 8 & 0xFF);
    range_with_ratio = max_range * max_ratio;

    #if defined foreach
        foreach (new i : Player) {
    #else
        for (new i = GetPlayerPoolSize(); i != -1; i--) {
    #endif
        if (!IsPlayerStreamedIn(i, playerid)) {
            continue;
        }

        range = GetPlayerDistanceFromPoint(i, pos_x, pos_y, pos_z);
        if (range > max_range) {
            continue;
        }

        range_ratio = (range_with_ratio - range) / range_with_ratio;
        clr_r = floatround(range_ratio * color_r);
        clr_g = floatround(range_ratio * color_g);
        clr_b = floatround(range_ratio * color_b);

        SendClientMessage(i, (color & 0xFF) | (clr_b << 8) | (clr_g << 16) | (clr_r << 24), string);
    }
        SendClientMessage(playerid, color, string);
        return 1;
}

ProxDetector mais atualizado (só precisa definir uma cor e o resto (fading com a distância) o construtor faz)


RE: Códigos Úteis - Nyft - 29/09/2020

Um método de converter para a moeda Real com uma simples stock:

Modo de uso:

Código PHP:
printf("%s"ConvertNumber(100));
printf("%s"ConvertNumber(1000));
printf("%s"ConvertNumber(10000));
printf("%s"ConvertNumber(100000)); 

Print:

R$100,00
R$1.000,00
R$10.000,00
R$100.000,00

Code:

Código PHP:
ConvertReal(value, const text[] = ".")
{
    new Var[20];
    format(Var, sizeof(Var), "%d"value);

    for(new strlen(Var) - 30-= 3)
        
strins(Var, textX);

    format(Var, sizeof(Var), "R$%s,00", Var);
    return Var;




RE: Códigos Úteis - SkolPlay - 29/09/2020

Para evitar colocar os carros das profissões na Hq, pra não deixar o servidor lagado por ter muitos carros, então eu fiz um método que já é utilizado em alguns servidores, que ao apertar uma tecla, você pega seu carro automaticamente.

Obs: Caso não seja código útil, só falar ai.
Código PHP:
#include a_samp


new Model;

public 
OnGameModeInit()
{
    
Create3DTextLabel("Pegar veiculo"0xFFFFFFFF,138.6627,-65.1454,1.57035000);
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    
SendClientMessage(playerid, -1"Criar veiculo usando uma tecla.(by: SkolPlay)");
    
SendClientMessage(playerid, -1"Não retire os creditos por gentileza");
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
newkeys == 65536)
    {
        
        if(
IsPlayerInRangeOfPoint(playerid2.0,138.6627,-65.1454,1.5703))
        {
            
            new 
Float:Pos[4];
            
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
            
GetPlayerFacingAngle(playerid,Pos[3]);
            
Model CreateVehicle(411Pos[0], Pos[1], Pos[2], Pos[3], -1,-1,-1);
            
PutPlayerInVehicle(playeridModel0);
            
SendClientMessage(playerid, -1"Você pegou um veiculo!");
        }
        else{
            
SendClientMessage(playerid, -1"Você não está na posição correta!");
        }
    }
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    
SetTimerEx("Destruir",1000*60,false,"d",vehicleid);
    return 
1;
}
forward Destruir(vehucleid);
public 
Destruir(vehucleid)
{
    
DestroyVehicle(vehucleid);




RE: Códigos Úteis - Vict9r - 30/09/2020

Comando de destranca e tranca o veiculo mesmo não estando dentro dele apenas do lado!


Código:
CMD:trancar(playerid, params[])
{
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
new testcar;
if(sscanf(params, "d", testcar))
{
    new counter = 0;
new result;
for(new i; i != MAX_VEHICLES; i++)
{
    new dist = ChecarveiculoSamp(5, playerid, i);
if(dist)
{
    result = i;
counter++;
}
}
switch(counter)
{
    case 0:
{
    SendClientMessage(playerid, vermelho, "[Samp]{FFFFFF}Nao ha nenhum carro perto de voce!");
}
case 1:
{
                GetVehicleParamsEx(result, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(result, engine, lights, alarm, VEHICLE_PARAMS_ON, bonnet, boot, objective);
    SendClientMessage(playerid, -1, "[Veiculo]{33CC33}Trancado");
  new Float:pX, Float:pY, Float:pZ;
  GetPlayerPos(playerid,pX,pY,pZ);
    PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
default:
{
    SendClientMessage(playerid, vermelho, "[Samp]{FFFFFF}Foram encontrados mais de um carro nesse local");
}
}
return true;
}
    return 1;
}

CMD:destrancar(playerid, params[])
{
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
new testcar;
if(sscanf(params, "d", testcar))
{
    new counter = 0;
new result;
for(new i; i != MAX_VEHICLES; i++)
{
    new dist = ChecarveiculoSamp(5, playerid, i);
if(dist)
{
    result = i;
counter++;
}
}
switch(counter)
{
    case 0:
{
    SendClientMessage(playerid, vermelho, "[Samp]{FFFFFF}Nao ha nenhum carro perto de voce!");
}
case 1:
{
  GetVehicleParamsEx(result, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(result, engine, lights, alarm, VEHICLE_PARAMS_OFF, bonnet, boot, objective);
    SendClientMessage(playerid, -1, "[Veiculo]{FF0000}Destrancado");
  new Float:pX, Float:pY, Float:pZ;
  GetPlayerPos(playerid,pX,pY,pZ);
    PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
default:
{
    SendClientMessage(playerid, vermelho, "[Samp]{FFFFFF}Foram encontrados mais de um carro nesse local");
}
}
return true;
}
    return 1;
}
stock ChecarveiculoSamp(Float:radi, playerid, vehicleid)
{
    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, radi, x, y, z))
        return 1;
    return 0;
}

[url=https://portalsamp.com/search.php?action=finduser&uid=37][/url]

Peguei o codigo da gm do meu servidor.


RE: Códigos Úteis - SrGhost_ - 30/09/2020

Comandos Úteis

/skin [Id]

Código PHP:
CMD:skin(playeridparams[])
{
 new 
id;
 if(
sscanf(params"d"id)) return SendClientMessage(playerid, -1"Use: /skin [id]");
 if(
id 300) return SendClientMessage(playerid, -1"Apenas ID Entre 1 - 300");
 if(
id <= 0) return SendClientMessage(playerid, -1"Apenas ID Entre 1 - 300");
 
SetPlayerSkin(playeridid);
 
SendClientMessage(playeridCOR_AMARELO"Voce mudou sua skin");
 return 
1;


( repara um veículo )

Código PHP:
CMD:reparar(playeridparams[])
{
new 
vehicleid GetPlayerVehicleID(playerid);
RepairVehicle(vehicleid);
SendClientMessage(playeridCOR_AMARELO"Veiculo reparado");
return 
1;


Mudar Cor Do Veiculo

Código PHP:
CMD:corveh(playeridparams[])
{
new 
vehicleid GetPlayerVehicleID(playerid);
new 
idid2;
if(
sscanf(params"dd"idid2)) return SendClientMessage(playerid, -1"Use: /corveh COR1 COR2");
if(
id 7) return SendClientMessage(playerid, -1"Escolha uma cor de 0 a 7");
if(
id2 7) return SendClientMessage(playerid, -1"Escolha uma cor de 0 a 7");
ChangeVehicleColor(vehicleididid2);
return 
1;


Espero Ter Ajudado...


RE: Códigos Úteis - Gabriel - 30/09/2020

Código:
Para nomes de veículos

new VehicleNames[212][] =
{
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
    {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
    {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
    {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
    {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
    {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
    {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
    {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
    {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
    {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
    {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
    {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
    {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
};

stock getVehicleName(vehicleid){
        new vehmodel = GetVehicleModel(vehicleid);
        new nameVeh[75];

        if (vehmodel < 400 || vehmodel > 611) {
                strcat(nameVeh, "Nenhum");
                return nameVeh;
        }
        strcat(nameVeh, VehicleNames[vehmodel - 400]);
        return nameVeh;
}



RE: Códigos Úteis - willttoonn - 03/10/2020

SendClientMessageEx - Funciona como um SendClientMessage, so que você pode formatar o texto com os atributos na própria função, eliminando a necessidade de um format a parte.

Código:
SendClientMessageEx(playerid, color, const str[], {Float,_}:...)
{
    static
        args,
        start,
        end,
        string[144]
    ;
    #emit LOAD.S.pri 8
    #emit STOR.pri args

    if (args > 12)
    {
        #emit ADDR.pri str
        #emit STOR.pri start

        for (end = start + (args - 12); end > start; end -= 4)
        {
            #emit LREF.pri end
            #emit PUSH.pri
        }
        #emit PUSH.S str
        #emit PUSH.C 144
        #emit PUSH.C string
        #emit PUSH.C args
        #emit SYSREQ.C format

        SendClientMessage(playerid, color, string);

        #emit LCTRL 5
        #emit SCTRL 4
        #emit RETN
    }
    return SendClientMessage(playerid, color, str);
}

Exemplo de uso (-1 é a cor, nesse caso branca):
Código:
new player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_name);
SendClientMessageEx(playerid, -1, "O meu nome é %s.", playername);



RE: Códigos Úteis - NelsonC. - 03/10/2020

(03/10/2020 00:26)willttoonn Escreveu: SendClientMessageEx - Funciona como um SendClientMessage, so que você pode formatar o texto com os atributos na própria função, eliminando a necessidade de um format a parte.

Código:
SendClientMessageEx(playerid, color, const str[], {Float,_}:...)
{
    static
        args,
        start,
        end,
        string[144]
    ;
    #emit LOAD.S.pri 8
    #emit STOR.pri args

    if (args > 12)
    {
        #emit ADDR.pri str
        #emit STOR.pri start

        for (end = start + (args - 12); end > start; end -= 4)
        {
            #emit LREF.pri end
            #emit PUSH.pri
        }
        #emit PUSH.S str
        #emit PUSH.C 144
        #emit PUSH.C string
        #emit PUSH.C args
        #emit SYSREQ.C format

        SendClientMessage(playerid, color, string);

        #emit LCTRL 5
        #emit SCTRL 4
        #emit RETN
    }
    return SendClientMessage(playerid, color, str);
}

Exemplo de uso (-1 é a cor, nesse caso branca):
Código:
new player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_name);
SendClientMessageEx(playerid, -1, "O meu nome é %s.", playername);


Mais fácil assim mano
Código PHP:
// macro
new __message[280];
#define SendClientMessage(%0,%1,%2,%3)             \
        
(format(__message,sizeof(__message),%2,%3),SendClientMessage(%0,%1,__message))

#define SendClientMessageToAll(%0,%1,%2)             \
        
(format(__message,sizeof(__message),%1,%2),SendClientMessageToAll(%0,__message)) 


Exemplos:

Código PHP:
new player_name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayer_name);
    
SendClientMessage(playerid, -1"Você tem %d de dinheiro"GetPlayerMoney(playerid));
    
SendClientMessageToAll(-1"O jogador %s tem %d de dinheiro."player_nameGetPlayerMoney(playerid));