SA-MP Forums Archive
Help a noob add new stuff??? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help a noob add new stuff??? (/showthread.php?tid=156319)



Help a noob add new stuff??? - Abraham2nd - 22.06.2010

ok i really need to know this thx in advance

i need to add a GPS in cars ...like /gps and a menu pops up saying select your destination and it marks the shortest place on road on ur minimap.
also i want to add a new job..
a hacker ...like /hackbank - makes you send an amount of money to ur account of course it would not always work.. like a 67% chance.
also a /hackplayerv - hack player vehicle ...makes vehicle stop in its tracks and player has to either get out and/or /trace - trace hacker of course u need to make that cmd too. so thx


Re: Help a noob add new stuff??? - Antonio [G-RP] - 22.06.2010

http://wiki.sa-mp.com - That will give you all those !


Re: Help a noob add new stuff??? - Abraham2nd - 22.06.2010

Quote:
Originally Posted by ♂ Antonio [G-RP
]
http://wiki.sa-mp.com - That will give you all those !
dont see any


Re: Help a noob add new stuff??? - titanak - 22.06.2010

for GPS systems look here

http://forum.sa-mp.com/index.php?topic=171998.0
http://forum.sa-mp.com/index.php?topic=157829.0
http://forum.sa-mp.com/index.php?topic=144189.0
http://forum.sa-mp.com/index.php?topic=135676.0
http://forum.sa-mp.com/index.php?topic=135866.0
http://forum.sa-mp.com/index.php?topic=135056.0
http://forum.sa-mp.com/index.php?topic=120780.0
http://forum.sa-mp.com/index.php?topic=127072.0
http://forum.sa-mp.com/index.php?topic=119256.0



Re: Help a noob add new stuff??? - Abraham2nd - 22.06.2010

Quote:
Originally Posted by » Titan «
wow thx looking now







Re: Help a noob add new stuff??? - Antonio [G-RP] - 22.06.2010

Quote:
Originally Posted by Abraham2nd
Quote:
Originally Posted by ♂ Antonio [G-RP
]
http://wiki.sa-mp.com - That will give you all those !
dont see any
Fucking idiot, I mean MAKE IT YOURSELF!


Re: Help a noob add new stuff??? - titanak - 22.06.2010

this is perfect if you are beginner coder and you make something good.
this is good if you make something and ask help from forum.
this is very bad if you ask all from forum and you dont try to make something.



Re: Help a noob add new stuff??? - Abraham2nd - 22.06.2010

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Quote:
Originally Posted by Abraham2nd
Quote:
Originally Posted by ♂ Antonio [G-RP
]
http://wiki.sa-mp.com - That will give you all those !
dont see any
i know IDIOT i mean i dont see any topics on how to!! damn, what a grouch



Fucking idiot, I mean MAKE IT YOURSELF!



Re: Help a noob add new stuff??? - Antonio [G-RP] - 22.06.2010

That teachs you everything about sa-mp scripting.


Re: Help a noob add new stuff??? - CuervO - 22.06.2010

My Script Contains a GPS Function with Distance and Direction...

Anywhere on the script under the defines:

pawn Код:
stock SetPlayerRouting(playerid, Float:x1, Float:y1, Float:z1)
{
    if(IsPlayerInAnyVehicle(playerid) && Gps[playerid] == 1)
    {
        new string[128];
        new textstring[200];
        new Float:x2, Float:y2, Float:z2;
      new Float:angle2;

        GetVehiclePos(GetPlayerVehicleID(playerid), x2, y2, z2);
        GetVehicleZAngle(GetPlayerVehicleID(playerid), angle2);

        new Float:dist;
        dist = floatsqroot(floatpower(floatabs(floatsub(x1,x2)),2)+floatpower(floatabs(floatsub(y1,y2)),2)+floatpower(floatabs(floatsub(z1,z2)),2));

        new Float:angle1;
        if( (y1-y2) >= 0.0) angle1 = acos((x1-x2)/dist) - 90;
        else angle1 = 270 - acos((x1-x2)/dist);

        new Float:offset;
        offset = 360.0 - angle2 + angle1;
        if(offset >= 360.0) offset = offset - 360.0;
        else if(offset < 0.0) offset = offset + 360.0;

        if(offset >= 330.0 || offset < 30.0) format(string, sizeof(string), "~u~ ~w~%d ~u~", floatround(dist));
        else if(offset >= 30.0 && offset < 60.0) format(string, sizeof(string), "~<~ ~w~%d", floatround(dist));
        else if(offset >= 60.0 && offset < 100.0) format(string, sizeof(string), "~<~~<~ ~w~%d", floatround(dist));
        else if(offset >= 100.0 && offset < 150.0) format(string, sizeof(string), "~d~~<~ ~w~%d", floatround(dist));
        else if(offset >= 150.0 && offset < 210.0) format(string, sizeof(string), "~d~ ~w~%d ~d~", floatround(dist));
        else if(offset >= 210.0 && offset < 260.0) format(string, sizeof(string), "~w~%d ~>~~d~", floatround(dist));
        else if(offset >= 260.0 && offset < 300.0) format(string, sizeof(string), "~w~%d ~>~~>~", floatround(dist));
        else if(offset >= 300.0 && offset < 330.0) format(string, sizeof(string), "~w~%d ~>~", floatround(dist));
        format(textstring,sizeof(textstring),"~r~Global Positionating System ~n~~n~~y~Now Tracking Coordinates: ~w~~n~X %.01f - Y %.01f - Z %.01f ~n~~n~ ~y~Distance & Direction: ~n~%s", x1, y1, z1, string);
        TextDrawSetString(Textdraw53[playerid],textstring);
        TelePosGps[playerid][tX] = x1;
        TelePosGps[playerid][tY] = y1;
        TelePosGps[playerid][tZ] = z1;
    }
    return 1;
}
Onplayercommandtext:

pawn Код:
dcmd(gpsfind, 7, cmdtext);
anywhere:

pawn Код:
dcmd_gpsfind(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new string[100];
    if (sscanf(params, "fff", x, y, z))
    {
        SendClientMessage(playerid, 0xBBBBBBAA, "TIP: /gpsfind <X> <Y> <Z>");
        SendClientMessage(playerid, 0xBBBBBBAA, "TIP: /gpsfind 0 0 0 To turn it off.");
        return 1;
    }
    else
    {
      if((x == 0 && y == 0 && z == 0) && Gps[playerid] == 1)
        {
          Gps[playerid] = 0;
          SendClientMessage(playerid, 0xFFFFFFFF, "You have Turned off your GPS");
          TextDrawHideForPlayer(playerid, Textdraw53[playerid]);
          KillTimer(gpstimer[playerid]);
        }
        else
        {
          if(IsPlayerInAnyVehicle(playerid))
          {
              Gps[playerid] = 1;
              SetPlayerRouting(playerid, x,y,z);
              format(string, sizeof(string), "You've set your coord to %f, %f, %f", x, y, z);
              SendClientMessage(playerid, 0xFFFFFFFF, string);
              TextDrawShowForPlayer(playerid, Textdraw53[playerid]);
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, "* You are not in a vehicle");
              return 1;
            }
        }
     }
    return 1;
}
at top of script under defines:

pawn Код:
new Gps[MAX_PLAYERS];
new gpstimer[MAX_PLAYERS];

enum TelePosEnum
{
  Float:tX,
  Float:tY,
  Float:tZ
};
new Float:TelePosGps[MAX_PLAYERS][TelePosEnum];

Onplayerentervehicle:

pawn Код:
if(Gps[playerid] == 1)
{
  TextDrawShowForPlayer(playerid, Textdraw53[playerid]);
}
onplayerconnect:

pawn Код:
gpstimer[playerid] = SetTimerEx("GpsCheck",1250,true,"i",playerid);
Gps[playerid] = 0;

Textdraw53[playerid] = TextDrawCreate(320.000000, 341.000000, " "); // GPS
TextDrawAlignment(Textdraw53[playerid], 2);
TextDrawBackgroundColor(Textdraw53[playerid], 255);
TextDrawFont(Textdraw53[playerid], 2);
TextDrawLetterSize(Textdraw53[playerid], 0.400000, 1.500000);
TextDrawColor(Textdraw53[playerid], -1);
TextDrawSetOutline(Textdraw53[playerid], 1);
TextDrawSetProportional(Textdraw53[playerid], 1);
Onplayerexitvehicle:

pawn Код:
KillTimer(gpstimer[playerid]);
TextDrawDestroy(Textdraw53[playerid]);
onplayerdeath:

pawn Код:
KillTimer(gpstimer[playerid]);
anywhere:

pawn Код:
forward GpsCheck(playerid);
public GpsCheck(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerRouting(playerid,TelePosGps[playerid][tX],TelePosGps[playerid][tY],TelePosGps[playerid][tZ]);
    }
    return 1;
}
anywhere 1 sec timer.

pawn Код:
SetPlayerRouting(i,TelePosGps[i][tX],TelePosGps[i][tY],TelePosGps[i][tZ]);

Use wiki if you don't know where to place