10.05.2012, 06:29
Ive never made an include, I have a Working system for detecting when a trailer is hooked/detached, but id like it as an include for nice code and to release in the forums if it works well.
What i have:
I need to override
OnGameModeInit & OnFilterScriptInit to use: aTrailers_startChecks()
OnGameModeExit & OnFilterScriptExit to use: aTrailers_endChecks()
Also, in my aTrailers_checkVehicleTrailer will CallLocalFunction("OnVehicleTrailerUpdate","iii",v ehicleid,trailerid,TRAILERSTATE_ATTACH); work correctly
Finaly, do i need to forward OnVehicleTrailerUpdate(vehicleid,trailerid,results tate) or native it?
Thanks for the help
What i have:
Код:
#include <a_samp> /* native OnVehicleTrailerUpdate(vehicleid,trailerid,resultstate); */ #define TRAILERSTATE_ATTACH 0 #define TRAILERSTATE_DETACH 1 #define aTrailers_isTruckModel(%0) ((%0==403)||(%0==514)||(%0==515)) #define aTrailers_isTrailerModel(%0) ((%0==435)||(%0==591)||(%0==450)||(%0==584)) #define aTrailers_isTruck(%0) ((%0>0)&&(isTruckModel(GetVehicleModel(%0)))) #define aTrailers_isTrailer(%0) ((%0>0)&&(isTrailerModel(GetVehicleModel(%0)))) new aTrailers_timer; new aTrailers_timerRunning=0; new aTrailers_trailers[MAX_VEHICLES]; forward aTrailers_checkvehicles(); public aTrailers_checkVehicles() { .... } stock aTrailers_checkVehicleTrailer(vehicleid){ .... CallLocalFunction("OnVehicleTrailerUpdate","iii",vehicleid,trailerid,TRAILERSTATE_ATTACH); .... } stock aTrailers_startChecks(){ if (aTrailers_timerRunning==0) { aTrailers_timer = SetTimer("aTrailers_checkVehicles", 250, true); //TRAILER HOOCKUP aTrailers_timerRunning = 1; } } stock aTrailers_endChecks(){ if (aTrailers_timerRunning==1) { KillTimer(aTrailers_timer); //TRAILER HOOCKUP END aTrailers_timerRunning = 0; } }
OnGameModeInit & OnFilterScriptInit to use: aTrailers_startChecks()
OnGameModeExit & OnFilterScriptExit to use: aTrailers_endChecks()
Also, in my aTrailers_checkVehicleTrailer will CallLocalFunction("OnVehicleTrailerUpdate","iii",v ehicleid,trailerid,TRAILERSTATE_ATTACH); work correctly
Finaly, do i need to forward OnVehicleTrailerUpdate(vehicleid,trailerid,results tate) or native it?
Thanks for the help
