Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SA-MP Include Trailer
- *
- * (c) by Kaliber, 2016
- *
- */
- #if !defined _samp_included
- #include <a_samp>
- #endif
- #if defined _samp_trailer
- #endinput
- #endif
- #define _samp_trailer
- /******************************************************************************/
- #define Hook:: _@@_
- /******************************************************************************/
- forward OnTrailerAttachedToVehicle(vehicleid, trailerid);
- forward OnTrailerDettachedFromVehicle(vehicleid, trailerid);
- /******************************************************************************/
- public OnGameModeInit()
- {
- SetTimer(!"@trailer_check",997,1);
- #if defined _@@_OnGameModeInit
- return Hook::OnGameModeInit();
- #else
- return 1;
- #endif
- }
- #if defined _@@_OnGameModeInit
- forward Hook::OnGameModeInit();
- #endif
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit _@@_OnGameModeInit
- /******************************************************************************/
- static @trailer_check();@trailer_check()
- {
- static v,str[16],t;
- for(v=GetVehiclePoolSize(); v!=0; v--)
- {
- format(str,sizeof(str),"v_%d",v);
- if(IsTrailerAttachedToVehicle(v))
- {
- if(existproperty(.name=str)) continue;
- t = GetVehicleTrailer(v);
- setproperty(.name=str,.value=t);
- CallLocalFunction(!"OnTrailerAttachedToVehicle",!"dd",v,t);
- }
- else
- {
- if(existproperty(.name=str))
- {
- CallLocalFunction(!"OnTrailerDettachedFromVehicle",!"dd",v,getproperty(.name=str));
- deleteproperty(.name=str);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement