SA-MP Forums Archive
whats wrong with this? - 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: whats wrong with this? (/showthread.php?tid=201344)



whats wrong with this? - Sweet_Mafia™ - 21.12.2010

I did something wrong in this but i dont know what, if someone could fix the problems they see and paste the whole code back as a reply that would be greate.

pawn Код:
#include <a_samp>
new rocket1;
new rocket2;
new rocket3;
new rocket4;
new rocket5;
new rocket6;
new rocket7;
new rocket8;
new rocket9;
new rocket10;
new rocket11;
new rocket12;
new rocket13;
new rocket14;
new rocket15;
new rocket16;
new rocket17;
new rocket18
new rocket19;
new rocket20;

public OnGameModeInit()
{
rocket1 = CreateObject(17049,361.51278687,1943.74755859,23.94000053,179.99450684,0.00000000,0.00000000);
rocket2 = CreateObject(17049,364.73217773,1945.26000977,23.94000053,179.99450684,0.00000000,0.00000000);
rocket3 = CreateObject(17049,361.27264404,1947.04602051,23.94000053,179.99450684,0.00000000,0.00000000);
rocket4 = CreateObject(18987,362.66940308,1945.44836426,36.07276154,0.00000000,0.00000000,0.00000000);
rocket5 = CreateObject(17049,362.85900879,1948.72985840,23.77276039,0.00000000,0.00000000,113.99996948);
rocket6 = CreateObject(1649,362.48815918,1941.83312988,50.31145477,0.00000000,0.00000000,179.49755859);//19o
rocket7 = CreateObject(1649,362.48815918,1948.93676758,50.31145477,0.00000000,0.00000000,0.00000000);//20
rocket8 = CreateObject(17951,362.77139282,1947.48535156,48.55171967,0.00000000,90.00000000,0.00000000);
rocket9 = CreateObject(17951,363.94308472,1946.98107910,48.55171967,0.00000000,90.00000000,322.00000000);
rocket10 = CreateObject(17951,361.46932983,1947.00854492,48.55171967,0.00000000,90.00000000,38.00000000);
rocket11 = CreateObject(17951,360.78305054,1945.93151855,48.55171967,0.00000000,90.00000000,71.99829102);
rocket12 = CreateObject(17951,360.92773438,1944.57910156,48.55171967,0.00000000,90.00000000,110.00000000);
rocket13 = CreateObject(17951,361.80957031,1943.50354004,48.55171967,0.00000000,90.00000000,147.99514771);
rocket14 = CreateObject(17951,362.85958862,1943.39575195,48.55171967,0.00000000,90.00000000,185.99133301);
rocket15 = CreateObject(17951,364.04949951,1944.04248047,48.55171967,0.00000000,90.00000000,221.98754883);
rocket16 = CreateObject(17951,364.65100098,1945.16735840,48.55171967,0.00000000,90.00000000,257.98425293);
rocket17 = CreateObject(17951,364.45504761,1946.34912109,48.55171967,0.00000000,90.00000000,287.98095703);
rocket18 = CreateObject(16501,364.02490234,1945.36242676,48.55171967,0.00000000,90.00000000,0.00000000);
rocket19 = CreateObject(16501,361.04910278,1945.38000488,48.55171967,0.00000000,90.00000000,0.00000000);
rocket20 = CreateObject(1649,358.85977173,1945.37377930,50.31145477,0.00000000,0.00000000,90.25000000);
return 1;
}

public OnGameModeExit()
{
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp(cmdtext, "/land", true) == 0){
        MoveObject(rocket1, 361.51278687,1943.74755859,23.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket2, 364.73217773,1945.26000977,23.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket3, 361.27264404,1947.04602051,23.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket4, 362.66940308,1945.44836426,36.07276154,0.00000000,0.00000000,0.00000000);
        MoveObject(rocket5, 362.85900879,1948.72985840,23.77276039,0.00000000,0.00000000,113.99996948);
        MoveObject(rocket6, 362.48815918,1941.83312988,50.31145477,0.00000000,0.00000000,179.49755859);
        MoveObject(rocket7, 362.48815918,1948.93676758,50.31145477,0.00000000,0.00000000,0.00000000);
         MoveObject(rocket8, 362.77139282,1947.48535156,48.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket9, 363.94308472,1946.98107910,48.55171967,0.00000000,90.00000000,322.00000000);
          MoveObject(rocket10, 361.46932983,1947.00854492,48.55171967,0.00000000,90.00000000,38.00000000);
          MoveObject(rocket11, 360.78305054,1945.93151855,48.55171967,0.00000000,90.00000000,71.99829102);
          MoveObject(rocket12, 360.92773438,1944.57910156,48.55171967,0.00000000,90.00000000,110.00000000);
          MoveObject(rocket13, 361.80957031,1943.50354004,48.55171967,0.00000000,90.00000000,147.99514771);
          MoveObject(rocket14, 362.85958862,1943.39575195,48.55171967,0.00000000,90.00000000,185.99133301);
          MoveObject(rocket15, 364.04949951,1944.04248047,48.55171967,0.00000000,90.00000000,221.98754883);
          MoveObject(rocket16, 364.65100098,1945.16735840,48.55171967,0.00000000,90.00000000,257.98425293);
          MoveObject(rocket17, 364.45504761,1946.34912109,48.55171967,0.00000000,90.00000000,287.98095703);
          MoveObject(rocket18, 364.02490234,1945.36242676,48.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket19, 361.04910278,1945.38000488,48.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket20,358.85977173,1945.37377930,50.31145477,0.00000000,0.00000000,90.25000000);
        return 1;
        }
        if (strcmp(cmdtext, "/launch", true) == 0){
        MoveObject(rocket1, 361.51278687,1943.74755859,63.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket2, 364.73217773,1945.26000977,63.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket3, 361.27264404,1947.04602051,63.94000053,179.99450684,0.00000000,0.00000000);
        MoveObject(rocket4, 362.66940308,1945.44836426,76.07276154,0.00000000,0.00000000,0.00000000);
        MoveObject(rocket5, 362.85900879,1948.72985840,63.77276039,0.00000000,0.00000000,113.99996948);
        MoveObject(rocket6, 362.48815918,1941.83312988,90.31145477,0.00000000,0.00000000,179.49755859);
        MoveObject(rocket7, 362.48815918,1948.93676758,90.31145477,0.00000000,0.00000000,0.00000000);
         MoveObject(rocket8, 362.77139282,1947.48535156,88.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket9, 363.94308472,1946.98107910,88.55171967,0.00000000,90.00000000,322.00000000);
          MoveObject(rocket10, 361.46932983,1947.00854492,88.55171967,0.00000000,90.00000000,38.00000000);
          MoveObject(rocket11, 360.78305054,1945.93151855,88.55171967,0.00000000,90.00000000,71.99829102);
          MoveObject(rocket12, 360.92773438,1944.57910156,88.55171967,0.00000000,90.00000000,110.00000000);
          MoveObject(rocket13, 361.80957031,1943.50354004,88.55171967,0.00000000,90.00000000,147.99514771);
          MoveObject(rocket14, 362.85958862,1943.39575195,88.55171967,0.00000000,90.00000000,185.99133301);
          MoveObject(rocket15, 364.04949951,1944.04248047,88.55171967,0.00000000,90.00000000,221.98754883);
          MoveObject(rocket16, 364.65100098,1945.16735840,88.55171967,0.00000000,90.00000000,257.98425293);
          MoveObject(rocket17, 364.45504761,1946.34912109,88.55171967,0.00000000,90.00000000,287.98095703);
          MoveObject(rocket18, 364.02490234,1945.36242676,88.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket19, 361.04910278,1945.38000488,88.55171967,0.00000000,90.00000000,0.00000000);
          MoveObject(rocket20,358.85977173,1945.37377930,90.31145477,0.00000000,0.00000000,90.25000000);
        return 1;
        }
        return 0;
}



Re: whats wrong with this? - vlastikczech - 21.12.2010

maybe posting your error will help


Re: whats wrong with this? - ToPhrESH - 21.12.2010

At
pawn Код:
new rocket18
You need to add a ";" at the end. Tell me if that fixes it..


Re: whats wrong with this? - TheYoungCapone - 21.12.2010

Quote:
Originally Posted by ToPhrESH
Посмотреть сообщение
At
pawn Код:
new rocket18
You need to add a ";" at the end. Tell me if that fixes it..
yea that looks like the problem


Re: whats wrong with this? - Sweet_Mafia™ - 21.12.2010

Quote:
Originally Posted by TheYoungCapone
Посмотреть сообщение
yea that looks like the problem
well i fixed that, and compiled, but the compiler always fails to compile, i mean its not my comp, i can compile my 37k worth of lines in gm, but this just crashed editor


Re: whats wrong with this? - ExeC - 21.12.2010

Lol, you need to separate the actual coordinates, not put the "all" coordinates in there. So, for example:

Код:
AddPlayerClass(126,1711.8013,-2112.8604,13.3828,271.2368,0,0,0,0,0,0);
You get:

Код:
AddPlayerClass(126,[1711.8013,-2112.8604,13.3828],271.2368,0,0,0,0,0,0); // P2
The last thing you get:

Код:
1711.8013,-2112.8604,13.3828
And now you cannot move an object witch doesn't have a name, as you are doing.
Example:

Код:
Moveobject(rocket, coordinates(1711.8013,-2112.8604,13.3828), 2.0); // 2.0 = Speed
And if you are doing a rocket, that goes up in the sky... Mm, you should just put add up some numbers to the coordinates,
example:

Код:
1711.8013,-2112.8604,13.3828+600
Now it will go up exactly 600.


Re: whats wrong with this? - Sweet_Mafia™ - 21.12.2010

Quote:
Originally Posted by ExeC
Посмотреть сообщение
Lol, you need to separate the actual coordinates, not put the "all" coordinates in there. So, for example:

Код:
AddPlayerClass(126,1711.8013,-2112.8604,13.3828,271.2368,0,0,0,0,0,0);
You get:

Код:
AddPlayerClass(126,[1711.8013,-2112.8604,13.3828],271.2368,0,0,0,0,0,0); // P2
The last thing you get:

Код:
1711.8013,-2112.8604,13.3828
And now you cannot move an object witch doesn't have a name, as you are doing.
Example:

Код:
Moveobject(rocket, coordinates(1711.8013,-2112.8604,13.3828), 2.0); // 2.0 = Speed
And if you are doing a rocket, that goes up in the sky... Mm, you should just put add up some numbers to the coordinates,
example:

Код:
1711.8013,-2112.8604,13.3828+600
Now it will go up exactly 600.
if i were to give you the /pwn script, could you edit and save/compile it and send me the /pwn and amx back to me?


Re: whats wrong with this? - Grim_ - 22.12.2010

Quote:
Originally Posted by ExeC
Посмотреть сообщение
Lol, you need to separate the actual coordinates, not put the "all" coordinates in there. So, for example:
I don't quite understand what you are trying to say, but if you are saying you don't need all the extra places after the decimal, then you are correct. However, it will have no effect on the script (just making the coordinates of the object slightly less precise).

I would suggest using an array next time, instead of the epic amount of variables you have there.
pawn Код:
new rocket[ 20 ];
// and
MoveObject( rocket[ 0 ], .... );
Would work wonders. But like stated above, it has no true effect, just makes it look cooler.