SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 18/08/2012, 12:48 AM   #1
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default creating a vehicle crashes the server, hmm.

pawn Code:
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 Code:
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:
Code:
[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!
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 18/08/2012, 12:56 AM   #2
Mauzen
High-roller
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 4,876
Reputation: 1597
Default Re: creating a vehicle crashes the server, hmm.

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

How do you access the natives from the plugin? samp GDK?
Mauzen is offline   Reply With Quote
Old 18/08/2012, 01:29 AM   #3
Arca
Big Clucker
 
Arca's Avatar
 
Join Date: Jul 2012
Location: Plano, Texas, United States
Posts: 171
Reputation: 33
Default Re: creating a vehicle crashes the server, hmm.

Quote:
Originally Posted by Lorenc_ View Post
[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.
__________________

Code:
Arca is offline   Reply With Quote
Old 18/08/2012, 02:33 AM   #4
samiras
Banned
 
Join Date: Mar 2009
Posts: 133
Reputation: 28
Default Re: creating a vehicle crashes the server, hmm.

Are you sure with C++ wrapper AddStaticVehicle ?
samiras is offline   Reply With Quote
Old 18/08/2012, 02:56 AM   #5
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: creating a vehicle crashes the server, hmm.

Quote:
Originally Posted by Mauzen View Post
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.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 18/08/2012, 05:20 AM   #6
Arca
Big Clucker
 
Arca's Avatar
 
Join Date: Jul 2012
Location: Plano, Texas, United States
Posts: 171
Reputation: 33
Default Re: creating a vehicle crashes the server, hmm.

Quote:
Originally Posted by Lorenc_ View Post
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.
__________________

Code:
Arca is offline   Reply With Quote
Old 18/08/2012, 08:18 AM   #7
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: creating a vehicle crashes the server, hmm.

Quote:
Originally Posted by Arca View Post
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.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server crashes when entering a vehicle _rAped Help Archive 6 30/12/2010 12:26 AM
Do not creating vehicle epranka Help Archive 8 02/06/2010 06:01 AM
pawno crashes while creating menu Owenlishious Help Archive 5 06/04/2010 05:05 PM
Commands creating random crashes.. _Vortex Help Archive 0 08/09/2009 02:22 AM
Spawned a vehicle ID that does not exsist now server crashes at login Phats983 Help Archive 1 04/04/2009 11:07 PM


All times are GMT. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.