Im stuck on something
#1

Hy iv made something for trucker job but im stuck on CreateVehicle
i dono how to create the trailer in the back of my Truck and in the same time to attach it
plz help

Code:

pawn Код:
if(strcmp(cmd,"/haul",true)==0)
  {
    new carid = GetPlayerVehicleID(playerid);
    if(IsPlayerConnected(playerid))
    {
     if (PlayerInfo[playerid][pJob] != 16)
     {
       SendClientMessage(playerid,COLOR_GREY," You are not a Trucker !");
       return 1;
     }
     if(PlayerToPoint(35.0, playerid,2199.0886,-2256.2117,13.5469))
     {
       if (IsATir(carid))
       {
         new rand = random(sizeof(checkpointr));
         CreateVehicle(584, i'm stuck here
         AttachTrailerToVehicle(carid, 584);
         GivePlayerCash(playerid, -5000);
         SetPlayerCheckpoint(playerid, checkpointr[rand][0], checkpointr[rand][1], checkpointr[rand][2], 8.0);
         CP[playerid] = 23;
       }
       else
       {
         SendClientMessage(playerid,COLOR_GREY," You are not in a Truck !");
         return 1;
       }
     }
     else
     {
       SendClientMessage(playerid,COLOR_GREY," You are not at the load point !");
       return 1;
     }
   }
   return 1;
  }
Reply
#2

https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#3

ok iv made that but now i have another problem....
if i enter in the respective checkpoint the Trailer is not Destroyed ...
how can i make it to destroy the respective trailer ?


CODE:

pawn Код:
else if(CP[playerid] == 23)
    {
     
      if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
      {
     new trailerid = GetVehicleTrailer(playerid);
     DestroyVehicle(trailerid);
     GivePlayerCash(playerid, 8000);
      }
      else
      {
     SendClientMessage(playerid, COLOR_LIGHTBLUE, "You don't have a Trailer attached");
     return 1;
      }
    }
i want to destroy my attached trailer ....
Reply
#4

I'm not sure, never worked with GetVehicleTrailer before.
pawn Код:
new trailerid=GetVehicleTrailer(GetPlayerVehicleID(playerid));
Reply
#5

If you saved the trailer number to an array when you spawn it:

pawn Код:
trailer[playerid] = CreateVehicle(trailer stuff in here);
When it comes to removing the trailer, just do:
DetachTrailer(trailer[playerid] other stuff here);

Followed by:
DestroyVehicle(trailer[playerid] other stuff here);

(Don't forget to set trailer[playerid] back to 0/-1)
Reply
#6

ok thx for the help...
i solve that problem

but now i have a new problem ...
when i connect and /login on the server i get this message like 6 times

"You must be standing at the point, you failed to claim"

and when i'm claiming a point i get this message twice
i just want to send it once...

"%s has successfully claimed %s for %s, it will be theirs in %d minutes!"

not only me .. all players but i dono why

CODE:
pawn Код:
public OnTutorialTimer()
{
    new playername[MAX_PLAYER_NAME];
    new string[256];
    new fam;
    for (new i=0; i<MAX_POINTS; i++)
    {
    if (Points[i][ClaimerId] != 255)
      {
          if (Points[i][TimeToClaim] > 0)
            {
                Points[i][TimeToClaim]--;
            }
          else
          {
            new claimer = Points[i][ClaimerId];
        for(new ppl = 0; ppl < MAX_PLAYERS; ppl++)
        {
          if(PlayerInfo[ppl][pMember] == 5 || PlayerInfo[ppl][pLeader] == 5)
          {
                   if (PlayerToPoint(60.0, claimer, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]))
               {
                 fam = PlayerInfo[claimer][pLeader];
                   GetPlayerName(claimer, playername, sizeof(playername));
                   format(string, sizeof(string), "%s has successfully claimed %s for Blue Gangsta, it will be theirs in %d minutes!", playername, Points[i][Name], TIME_TO_TAKEOVER);
                       SendClientMessageToAll(COLOR_YELLOW, string);
                       Points[i][TakeOverTimerStarted] = 1;
                       Points[i][TakeOverTimer] = 0;
                       Points[i][ClaimerId] = 255;
                       Points[i][BeingClaimed] = 0;
                       Points[i][ClaimerTeam] = fam;
               }
               else
               {
                       SendClientMessage(Points[i][ClaimerId], COLOR_LIGHTBLUE, "You must be standing at the point, you failed to claim");
                 Points[i][ClaimerId] = 255;
                 Points[i][ClaimerTeam] = 255;
                 Points[i][TakeOverTimer] = 0;
                 Points[i][TakeOverTimerStarted] = 0;
                 Points[i][BeingClaimed] = 0;
                   }
                  }
                  else if(PlayerInfo[ppl][pMember] == 6 || PlayerInfo[ppl][pLeader] == 6)
          {
                   if (PlayerToPoint(60.0, claimer, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]))
               {
                 fam = PlayerInfo[claimer][pLeader];
                   GetPlayerName(claimer, playername, sizeof(playername));
                   format(string, sizeof(string), "%s has successfully claimed %s for Mafia, it will be theirs in %d minutes!", playername, Points[i][Name], TIME_TO_TAKEOVER);
                       SendClientMessageToAll(COLOR_YELLOW, string);
                       Points[i][TakeOverTimerStarted] = 1;
                       Points[i][TakeOverTimer] = 0;
                       Points[i][ClaimerId] = 255;
                       Points[i][BeingClaimed] = 0;
                       Points[i][ClaimerTeam] = fam;
               }
               else
               {
                       SendClientMessage(Points[i][ClaimerId], COLOR_LIGHTBLUE, "You must be standing at the point, you failed to claim");
                 Points[i][ClaimerId] = 255;
                 Points[i][ClaimerTeam] = 255;
                 Points[i][TakeOverTimer] = 0;
                 Points[i][TakeOverTimerStarted] = 0;
                 Points[i][BeingClaimed] = 0;
                   }
                  }
                  else if(PlayerInfo[ppl][pMember] == 10 || PlayerInfo[ppl][pLeader] == 10)
          {
                   if (PlayerToPoint(60.0, claimer, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]))
               {
                 fam = PlayerInfo[claimer][pLeader];
                   GetPlayerName(claimer, playername, sizeof(playername));
                   format(string, sizeof(string), "%s has successfully claimed %s for East Side Crips, it will be theirs in %d minutes!", playername, Points[i][Name], TIME_TO_TAKEOVER);
                       SendClientMessageToAll(COLOR_YELLOW, string);
                       Points[i][TakeOverTimerStarted] = 1;
                       Points[i][TakeOverTimer] = 0;
                       Points[i][ClaimerId] = 255;
                       Points[i][BeingClaimed] = 0;
                       Points[i][ClaimerTeam] = fam;
               }
               else
               {
                       SendClientMessage(Points[i][ClaimerId], COLOR_LIGHTBLUE, "You must be standing at the point, you failed to claim");
                 Points[i][ClaimerId] = 255;
                 Points[i][ClaimerTeam] = 255;
                 Points[i][TakeOverTimer] = 0;
                 Points[i][TakeOverTimerStarted] = 0;
                 Points[i][BeingClaimed] = 0;
                   }
                  }
                  else if(PlayerInfo[ppl][pMember] == 11 || PlayerInfo[ppl][pLeader] == 11)
          {
                   if (PlayerToPoint(60.0, claimer, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]))
               {
                 fam = PlayerInfo[claimer][pLeader];
                   GetPlayerName(claimer, playername, sizeof(playername));
                   format(string, sizeof(string), "%s has successfully claimed %s for Latin Kings, it will be theirs in %d minutes!", playername, Points[i][Name], TIME_TO_TAKEOVER);
                       SendClientMessageToAll(COLOR_YELLOW, string);
                       Points[i][TakeOverTimerStarted] = 1;
                       Points[i][TakeOverTimer] = 0;
                       Points[i][ClaimerId] = 255;
                       Points[i][BeingClaimed] = 0;
                       Points[i][ClaimerTeam] = fam;
               }
               else
               {
                       SendClientMessage(Points[i][ClaimerId], COLOR_LIGHTBLUE, "You must be standing at the point, you failed to claim");
                 Points[i][ClaimerId] = 255;
                 Points[i][ClaimerTeam] = 255;
                 Points[i][TakeOverTimer] = 0;
                 Points[i][TakeOverTimerStarted] = 0;
                 Points[i][BeingClaimed] = 0;
                   }
                  }
                  else if(PlayerInfo[ppl][pMember] == 12 || PlayerInfo[ppl][pLeader] == 12)
          {
                   if (PlayerToPoint(60.0, claimer, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]))
               {
                 fam = PlayerInfo[claimer][pLeader];
                   GetPlayerName(claimer, playername, sizeof(playername));
                   format(string, sizeof(string), "%s has successfully claimed %s for Ballas, it will be theirs in %d minutes!", playername, Points[i][Name], TIME_TO_TAKEOVER);
                       SendClientMessageToAll(COLOR_YELLOW, string);
                       Points[i][TakeOverTimerStarted] = 1;
                       Points[i][TakeOverTimer] = 0;
                       Points[i][ClaimerId] = 255;
                       Points[i][BeingClaimed] = 0;
                       Points[i][ClaimerTeam] = fam;
               }
               else
               {
                       SendClientMessage(Points[i][ClaimerId], COLOR_LIGHTBLUE, "You must be standing at the point, you failed to claim");
                 Points[i][ClaimerId] = 255;
                 Points[i][ClaimerTeam] = 255;
                 Points[i][TakeOverTimer] = 0;
                 Points[i][TakeOverTimerStarted] = 0;
                 Points[i][BeingClaimed] = 0;
                   }
                  }
                }
          }
      }
      if (Points[i][TakeOverTimerStarted])
      {
      fam = Points[i][ClaimerTeam];
      for(new ppl2 = 0; ppl2 < MAX_PLAYERS; ppl2++)
      {
       if(PlayerInfo[ppl2][pMember] == 5 || PlayerInfo[ppl2][pLeader] == 5)
       {
         if (Points[i][TakeOverTimer] < TIME_TO_TAKEOVER * 6)
         {
          Points[i][TakeOverTimer]++;
         }
         else
         {
          Points[i][ClaimerTeam] = 255;
          Points[i][TakeOverTimer] = 0;
          Points[i][TakeOverTimerStarted] = 0;
          Points[i][Vulnerable] = NEW_VULNERABLE;
          strmid(Points[i][Owner], "Blue Gangsta", 0, 32, 32);
          format(string, sizeof(string), "Blue Gangsta has successfully claimed %s", Points[i][Name]);
          SendClientMessageToAll(COLOR_YELLOW, string);
          UpdatePoints();
         }
           }
           else if(PlayerInfo[ppl2][pMember] == 6 || PlayerInfo[ppl2][pLeader] == 6)
       {
         if (Points[i][TakeOverTimer] < TIME_TO_TAKEOVER * 6)
         {
          Points[i][TakeOverTimer]++;
         }
         else
         {
          Points[i][ClaimerTeam] = 255;
          Points[i][TakeOverTimer] = 0;
          Points[i][TakeOverTimerStarted] = 0;
          Points[i][Vulnerable] = NEW_VULNERABLE;
          strmid(Points[i][Owner], "Mafia", 0, 32, 32);
          format(string, sizeof(string), "Mafia has successfully claimed %s", Points[i][Name]);
          SendClientMessageToAll(COLOR_YELLOW, string);
          UpdatePoints();
         }
           }
           else if(PlayerInfo[ppl2][pMember] == 10 || PlayerInfo[ppl2][pLeader] == 10)
       {
         if (Points[i][TakeOverTimer] < TIME_TO_TAKEOVER * 6)
         {
          Points[i][TakeOverTimer]++;
         }
         else
         {
          Points[i][ClaimerTeam] = 255;
          Points[i][TakeOverTimer] = 0;
          Points[i][TakeOverTimerStarted] = 0;
          Points[i][Vulnerable] = NEW_VULNERABLE;
          strmid(Points[i][Owner], "East Side", 0, 32, 32);
          format(string, sizeof(string), "East Side Crips has successfully claimed %s", Points[i][Name]);
          SendClientMessageToAll(COLOR_YELLOW, string);
          UpdatePoints();
         }
           }
           else if(PlayerInfo[ppl2][pMember] == 11 || PlayerInfo[ppl2][pLeader] == 11)
       {
         if (Points[i][TakeOverTimer] < TIME_TO_TAKEOVER * 6)
         {
          Points[i][TakeOverTimer]++;
         }
         else
         {
          Points[i][ClaimerTeam] = 255;
          Points[i][TakeOverTimer] = 0;
          Points[i][TakeOverTimerStarted] = 0;
          Points[i][Vulnerable] = NEW_VULNERABLE;
          strmid(Points[i][Owner], "Latin Kings", 0, 32, 32);
          format(string, sizeof(string), "Latin Kings has successfully claimed %s", Points[i][Name]);
          SendClientMessageToAll(COLOR_YELLOW, string);
          UpdatePoints();
         }
           }
           else if(PlayerInfo[ppl2][pMember] == 12 || PlayerInfo[ppl2][pLeader] == 12)
       {
         if (Points[i][TakeOverTimer] < TIME_TO_TAKEOVER * 6)
         {
          Points[i][TakeOverTimer]++;
         }
         else
         {
          Points[i][ClaimerTeam] = 255;
          Points[i][TakeOverTimer] = 0;
          Points[i][TakeOverTimerStarted] = 0;
          Points[i][Vulnerable] = NEW_VULNERABLE;
          strmid(Points[i][Owner], "Ballas", 0, 32, 32);
          format(string, sizeof(string), "Ballas has successfully claimed %s", Points[i][Name]);
          SendClientMessageToAll(COLOR_YELLOW, string);
          UpdatePoints();
         }
           }
        }
      }
      if (Points[i][Vulnerable] == 0 && Points[i][Type] > 0 && Points[i][Announced] == 0 && Points[i][ClaimerId] == 255)
      {
        format(string, sizeof(string), "%s has become vulnerable to takeover!", Points[i][Name]);
        SendClientMessageToAll(COLOR_HITRED, string);
        Points[i][Announced] = 1;
      }
    }
    return 1;
}
Reply
#7

It's your 3rd problem... Create a new topic instead of coming every 15 minutes with "I got a new problem"
Reply
#8

offtopic but...
Who the fuck is Gilad Shalit? :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)