Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Entrar

descriptionBasic TDM (base para GM de TDM/DM) EmptyBasic TDM (base para GM de TDM/DM)

more_horiz
Uma base pra quem quiser codar um GM de TDM/DM

Código:


//###################//
//# Basic TDM 1.0  #//
//# By: WH_FusioN  #//
//###################//
//[INCLUDES]
#include <a_samp>
#include <dini>

//[DEFINES]
#define AZUL 0x0000FFAA
#define VERMELHO 0xFF0000AA
#define AMARELO 0xFFFF00AA
#define LARANJA 0xFF6A00AA
#define VERDE 0x00FF00AA
#define CASTANHO 0x855600AA
#define CINZENTO 0x9E9E9EAA
#define ROSA 0xFF00FFAA
#define PRETO 0x000000AA
#define BRANCO 0xFFFFFFAA

//[VARS]
new time[MAX_PLAYERS];
enum info
{
   kills,
   mortes,
   nivel,
   respeito,
   admin,
   vip
};
new player[MAX_PLAYERS][info];

main()
{
   print("\n----------------------------------");
   print("          Basic TDM 1.0");
   print("          By: WH_FusioN");
   print("----------------------------------\n");
}

public OnGameModeInit()
{
   //[CONFIGS]
   SetGameModeText("BTDM 1.0");
   SendRconCommand("hostname Basic TDM 1.0");
   SendRconCommand("mapname Los Santos");
   SendRconCommand("website ---");
   //[TIMES]
   AddPlayerClass(0, -2130.185546875, 150.03318786621, 42.665424346924, 269.1425, 0, 0, 0, 0, 0, 0);//Time 1
   AddPlayerClass(1, -2087.982421875, 303.9518737793, 42.186256408691, 269.1425, 0, 0, 0, 0, 0, 0);//Time 2
   //[OBJETOS]
   CreateObject(972,-2082.10009766,123.50000000,31.00000000,0.00000000,0.00000000,264.00000000); //object(tunnelentrance) (1)
   CreateObject(972,-2071.19995117,129.39999390,30.50000000,0.00000000,0.00000000,355.99597168); //object(tunnelentrance) (2)
   CreateObject(972,-2074.80004883,151.39999390,30.50000000,0.00000000,0.00000000,27.99548340); //object(tunnelentrance) (5)
   CreateObject(972,-2081.60009766,176.00000000,30.50000000,0.00000000,0.00000000,357.99316406); //object(tunnelentrance) (6)
   CreateObject(972,-2069.89990234,197.39999390,32.29999924,0.00000000,0.00000000,293.98950195); //object(tunnelentrance) (7)
   CreateObject(972,-2044.80004883,203.30000305,32.29999924,0.00000000,0.00000000,267.98864746); //object(tunnelentrance) (8)
   CreateObject(972,-2034.30004883,209.80000305,32.29999924,0.00000000,0.00000000,1.98400879); //object(tunnelentrance) (9)
   CreateObject(972,-2035.50000000,233.89999390,32.29999924,0.00000000,0.00000000,1.98303223); //object(tunnelentrance) (10)
   CreateObject(972,-2036.09997559,255.39999390,32.29999924,0.00000000,0.00000000,1.98303223); //object(tunnelentrance) (11)
   CreateObject(972,-2036.90002441,277.00000000,32.29999924,0.00000000,0.00000000,1.98303223); //object(tunnelentrance) (12)
   CreateObject(972,-2037.40002441,297.60000610,32.29999924,0.00000000,0.00000000,1.98303223); //object(tunnelentrance) (13)
   CreateObject(972,-2044.59997559,308.79998779,32.29999924,0.00000000,0.00000000,89.98303223); //object(tunnelentrance) (14)
   CreateObject(972,-2067.60009766,308.89999390,32.29999924,0.00000000,0.00000000,89.97802734); //object(tunnelentrance) (15)
   CreateObject(972,-2090.60009766,309.00000000,32.29999924,0.00000000,0.00000000,89.97802734); //object(tunnelentrance) (16)
   CreateObject(972,-2113.10009766,309.10000610,32.29999924,0.00000000,0.00000000,89.97802734); //object(tunnelentrance) (17)
   CreateObject(972,-2129.60009766,309.29998779,32.29999924,0.00000000,0.00000000,89.97802734); //object(tunnelentrance) (18)
   CreateObject(972,-2140.50000000,302.20001221,32.29999924,0.00000000,0.00000000,177.97802734); //object(tunnelentrance) (19)
   CreateObject(972,-2140.50000000,302.19921875,32.29999924,0.00000000,0.00000000,177.97302246); //object(tunnelentrance) (20)
   CreateObject(972,-2140.60009766,284.89999390,32.29999924,0.00000000,0.00000000,181.97302246); //object(tunnelentrance) (21)
   CreateObject(972,-2140.39990234,277.60000610,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (22)
   CreateObject(972,-2139.80004883,256.70001221,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (23)
   CreateObject(972,-2138.89990234,233.60000610,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (24)
   CreateObject(972,-2138.00000000,209.69999695,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (25)
   CreateObject(972,-2136.80004883,187.80000305,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (26)
   CreateObject(972,-2136.19995117,166.30000305,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (27)
   CreateObject(972,-2135.80004883,143.80000305,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (28)
   CreateObject(972,-2135.60009766,130.80000305,32.29999924,0.00000000,0.00000000,181.97204590); //object(tunnelentrance) (29)
   CreateObject(972,-2129.00000000,120.69999695,32.29999924,0.00000000,0.00000000,273.97204590); //object(tunnelentrance) (30)
   CreateObject(972,-2110.50000000,121.90000153,32.29999924,0.00000000,0.00000000,273.97155762); //object(tunnelentrance) (31)
   CreateObject(972,-2099.39990234,123.80000305,32.29999924,0.00000000,0.00000000,273.97155762); //object(tunnelentrance) (32)
   return 1;
}

public OnGameModeExit()
{
   return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
   SetPlayerInterior(playerid,14);
   SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
   SetPlayerFacingAngle(playerid, 270.0);
   SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
   SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
   if(classid == 0)
   {
       GameTextForPlayer(playerid,"~r~Time 1",5000,6);
       SetPlayerSkin(playerid, 163);
      time[playerid] = 1;
   }
   else if(classid == 1)
   {
       GameTextForPlayer(playerid,"~g~Time 2",5000,6);
       SetPlayerSkin(playerid, 164);
      time[playerid] = 2;
   }
   return 1;
}

public OnPlayerConnect(playerid)
{
    new string[255];
    SendClientMessage(playerid, AMARELO, "Seja bem-vindo ao Basic TDM.");
   format(string,255,"contas/%s.ini",playername(playerid));
   if(dini_Exists(string))
   {
       ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login","Insira a sua password para logar:","OK","Sair");
   }
   if(!dini_Exists(string))
   {
       ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Registro","Insira uma password para registrar:","OK","Sair");
   }
   return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    saveacc(playerid);
   return 1;
}

public OnPlayerSpawn(playerid)
{
    if(time[playerid] == 1)
   {
      SetPlayerColor(playerid, 0x00FFFFAA);
      GivePlayerWeapon(playerid, 24, 99999);
   }
   else if(time[playerid] == 2)
   {
      SetPlayerColor(playerid, 0xFF00FFAA);
      GivePlayerWeapon(playerid, 24, 99999);
   }
   SetPlayerInterior(playerid, 0);
   return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    player[killerid][kills] ++;
    player[playerid][mortes] ++;
    if(player[killerid][respeito] >= 5)
    {
         player[killerid][respeito] = 0;
         player[killerid][nivel] ++;
         SendClientMessage(killerid, VERDE, "Parabens! Você ganhou um nivel! /stats para mais info");
         return 1;
   }
   else
   {
       player[killerid][respeito] ++;
   }
   return 1;
}

public OnVehicleSpawn(vehicleid)
{
   return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
   return 1;
}

public OnPlayerText(playerid, text[])
{
   return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
   if(!IsPlayerConnected(playerid)) return 1;
   if(strcmp("/stats", cmdtext, true, 6) == 0)
   {
       new string[255];
       format(string,255,"Nivel: %d || Kills: %d || Mortes: %d || Respeito: %d/5", player[playerid][nivel], player[playerid][kills], player[playerid][mortes], player[playerid][respeito]);
       SendClientMessage(playerid, CINZENTO, string);
      return 1;
   }
   if(strcmp("/creditos", cmdtext, true, 9) == 0)
   {
       SendClientMessage(playerid, CINZENTO, "Scripter & Mapper: WH_FusioN");
      return 1;
   }
   if(strcmp("/admins", cmdtext, true, 7) == 0)
   {
       new string[255];
      SendClientMessage(playerid, ROSA, "Admins Online:");
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
         if(IsPlayerConnected(i))
         {
             if(player[i][admin] >= 1 || IsPlayerAdmin(i))
             {
               format(string, 255, "Nome: %s | Nivel: %d", playername(i), player[i][admin]);
               SendClientMessage(playerid, CINZENTO, string);
            }
         }
      }
      return 1;
   }
   if(strcmp("/vips", cmdtext, true, 5) == 0)
   {
      new string[255];
      SendClientMessage(playerid, AZUL, "VIP's Online:");
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
         if(IsPlayerConnected(i))
         {
             if(player[i][vip] >= 1)
             {
               format(string, 255, "Nome: %s | Nivel: %d", playername(i), player[i][vip]);
               SendClientMessage(playerid, CINZENTO, string);
            }
         }
      }
      return 1;
   }
   return SendClientMessage(playerid, VERMELHO, "[ERRO]: Comando não existente.");
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
   return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
   return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
   return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
   return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
   return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
   return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
   return 1;
}

public OnRconCommand(cmd[])
{
   return 1;
}

public OnPlayerRequestSpawn(playerid)
{
   return 1;
}

public OnObjectMoved(objectid)
{
   return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
   return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
   return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
   return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
   return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
   return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
   return 1;
}

public OnPlayerExitedMenu(playerid)
{
   return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
   return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
   return 1;
}

public OnPlayerUpdate(playerid)
{
   return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
   return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
   return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
   return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
   return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   new string[255];
    format(string, 255,"contas/%s.ini",playername(playerid));
     if(dialogid == 1)
     {
       if(!response) return Kick(playerid);
       if(!strcmp(inputtext, dini_Get(string,"Senha")))
         {
           SendClientMessage(playerid, VERDE, "Escolha sua time");
           setacc(playerid);
       }
         else return Kick(playerid);
   }
    if(dialogid == 2)
     {
        if(!response) return Kick(playerid);
        SendClientMessage(playerid, VERDE, "Escolha sua time");
         dini_Create(string);
         dini_Set(string, "Senha", inputtext);
         saveacc(playerid);
         setacc(playerid);
   }
   return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
   return 1;
}

stock saveacc(playerid)
{
    new string[255];
    format(string, 255,"contas/%s.ini", playername(playerid));
   dini_IntSet(string,"Kills",player[playerid][kills]);
    dini_IntSet(string,"Mortes",player[playerid][mortes]);
     dini_IntSet(string,"Nivel",player[playerid][nivel]);
     dini_IntSet(string,"Respeito",player[playerid][respeito]);
     dini_IntSet(string,"Admin",player[playerid][admin]);
     dini_IntSet(string,"VIP",player[playerid][vip]);
    return 1;
}

stock setacc(playerid)
{
   new string[255];
    format(string, 255,"contas/%s.ini", playername(playerid));
     ResetPlayerMoney(playerid);
     player[playerid][kills] = dini_Int(string,"Kills");
    player[playerid][mortes] = dini_Int(string,"Mortes");
    player[playerid][nivel] = dini_Int(string,"Nivel");
    player[playerid][respeito] = dini_Int(string,"Respeito");
    player[playerid][admin] = dini_Int(string,"Admin");
    player[playerid][vip] = dini_Int(string,"VIP");
    return 1;
}

stock playername(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

strtok(const string[], &index)
{
   new length = strlen(string);
   while ((index < length) && (string[index] <= ' '))
   {
      index++;
   }

   new offset = index;
   new result[20];
   while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
   {
      result[index - offset] = string[index];
      index++;
   }
   result[index - offset] = EOS;
   return result;
}

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
bem basico mesmo Very Happy , coloca umas sala com uns comandos isso nao e tal dificil Very Happy

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
Up

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
Não gosto de TDM '-' HAHAHA, um dia vo ser scripter ainda... treino mt isso!

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
Mei descente Smile

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
Ao invés de strcmp no OnPlayerCommand, poderia usar ZCMD com sscanf2, ao invés de strtok. E ao invés de dini, usasse Y_INI.

Fora isso, tá muito simples, porem legal. 6/10 Very Happy

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
Nossa esse GM ai ja tá quase virando um zumbie !!

@Closed

descriptionBasic TDM (base para GM de TDM/DM) EmptyRe: Basic TDM (base para GM de TDM/DM)

more_horiz
privacy_tip Permissões neste sub-fórum
Não podes responder a tópicos
power_settings_newInicie sessão para responder