SA-MP Forums Archive
creating a vehicle crashes the server, hmm. - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: creating a vehicle crashes the server, hmm. (/showthread.php?tid=369747)



creating a vehicle crashes the server, hmm. - Lorenc_ - 18.08.2012

pawn Код:
static cell AMX_NATIVE_CALL vs_AddStaticVehicle(AMX *amx, cell *params)
{
    int model = params[ 1 ];
    float X = amx_ctof( params[ 2 ] );
    float Y = amx_ctof( params[ 3 ] );
    float Z = amx_ctof( params[ 4 ] );
    float A = amx_ctof( params[ 5 ] );
    int color1 = params[ 6 ];
    int color2 = params[ 7 ];


    logprintf("AddStaticVehicle( %d, %f, %f, %f, %f, %d, %d );", model, X, Y, Z, A, color1, color2 );
    int id = AddStaticVehicle( model, X, Y, Z, A, color1, color2 );
    return id;
}
Once I run that function, it just crashes the server. Something is wrong with AddStaticVehicle, but I'm not sure.

Input:
pawn Код:
native vs_AddStaticVehicle( modelid, Float: X, Float: Y, Float: Z, Float: Angle, color1, color2 );

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    vs_AddStaticVehicle( 560, 69.0, 69.0, 69.0, 270.0, 126, 126 );
    return 1;
}
Output:
Код:
[10:56:26] AddStaticVehicle( 560, 69.000000, 69.000000, 69.000000, 270.000000, 126, 126 );
Extremely grateful if someone helps, this is my first plugin I'm trying to develop!


Re: creating a vehicle crashes the server, hmm. - Mauzen - 18.08.2012

Seems like once people "mastered" pawn they all proceed with plugins

How do you access the natives from the plugin? samp GDK?


Re: creating a vehicle crashes the server, hmm. - Arca - 18.08.2012

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
[pawn]static cell AMX_NATIVE_CALL vs_AddStaticVehicle(AMX *amx, cell *params)
{
int model = params[ 1 ];
float X = amx_ctof( params[ 2 ] );
float Y = amx_ctof( params[ 3 ] );
float Z = amx_ctof( params[ 4 ] );
float A = amx_ctof( params[ 5 ] );
int color1 = params[ 6 ];
int color2 = params[ 7 ];


logprintf("AddStaticVehicle( %d, %f, %f, %f, %f, %d, %d );", model, X, Y, Z, A, color1, color2 );
int id = AddStaticVehicle( model, X, Y, Z, A, color1, color2 );
return id;
}
You provided "cell" as the return value at the function prototype but later on you are returning id which is an int.


Re: creating a vehicle crashes the server, hmm. - samiras - 18.08.2012

Are you sure with C++ wrapper AddStaticVehicle ?


Re: creating a vehicle crashes the server, hmm. - Lorenc_ - 18.08.2012

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Seems like once people "mastered" pawn they all proceed with plugins

How do you access the natives from the plugin? samp GDK?
I haven't mastered PAWN, I'm just making a plugin which stops vehicle teleportation via unoccupied sync. I found PAWN rather too slow lol.

Yes, I use sampGDK, the latest.


Re: creating a vehicle crashes the server, hmm. - Arca - 18.08.2012

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
I haven't mastered PAWN, I'm just making a plugin which stops vehicle teleportation via unoccupied sync. I found PAWN rather too slow lol.

Yes, I use sampGDK, the latest.
PAWN is actually faster than sampgdk although C++ is 10 times powerful than PAWN.


Re: creating a vehicle crashes the server, hmm. - Lorenc_ - 18.08.2012

Quote:
Originally Posted by Arca
Посмотреть сообщение
You provided "cell" as the return value at the function prototype but later on you are returning id which is an int.
It does no difference.

Anyhow, I use SDK and SAMPGDK if that means anything.