Raised This Month: $ Target: $400
 0% 

Ladder. save coordinats


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
BeasTeHbIw
Junior Member
Join Date: Oct 2013
Old 05-22-2014 , 08:53   Ladder. save coordinats
Reply With Quote #1

Hi.
Help to save the coordinates of stairs to when the map changes, stairs remained
Code:
#include <amxmodx> #include <fakemeta_util> #pragma semicolon 1 #define MODEL "models/ladder.mdl" // ladder dimensions new Float:gLadderMinY[3] = {-32.0,-4.0,-32.0}; new Float:gLadderMaxY[3] = { 32.0, 4.0, 32.0}; new bool:gOnLadder[33]; public plugin_init() {     register_plugin("Ladder", "1.0", "xPaw");           register_clcmd("say .ladder", "cmdCreateLadder");     register_clcmd("say .removeladder", "cmdDeleteLadder");           register_forward( FM_PlayerPreThink, "fwdPlayerPreThink", 0 );     register_forward( FM_Touch, "fwdTouch" ); } public plugin_precache()     precache_model( MODEL ); public fwdPlayerPreThink(id) {     if ( is_user_alive(id)) {         if( gOnLadder[id] ) {             new Float:velocity[3];             pev(id, pev_velocity, velocity);                           if ( (pev(id, pev_button) & IN_FORWARD) && (velocity[0] == 0.0 || velocity[1] == 0.0) ) {                 velocity[2] = 250.0;                 set_pev(id, pev_velocity, velocity);             }             gOnLadder[id] = false;         }                   new ent, body;         get_user_aiming(id, ent, body, 320);                   if (isLadder(ent)) {             set_hudmessage(0, 25, 255, -1.0, -0.90, 0, 1.0, 1.0, 0.2, 0.2, 1);             show_hudmessage(id, "First In-Game Ladder.");         }     } } public fwdTouch(ent, id) {     if (is_user_alive(id) && isLadder(ent)) {         set_pev(id, pev_movetype, MOVETYPE_FLY);                   gOnLadder[id] = true;                   // Velocity way         new Float:velocity[3];         pev(id, pev_velocity, velocity);                   if ( (pev(id, pev_button) & IN_FORWARD) && (velocity[0] == 0.0 || velocity[1] == 0.0) ) {             velocity[2] = 250.0;             set_pev(id, pev_velocity, velocity);         }               } } public cmdCreateLadder( id ) {     if (get_user_flags(id) & ADMIN_KICK) {         new Float:vOrigin[3];         new origin[3];                   //get the origin of the player and add Z offset         get_user_origin(id, origin, 3);         IVecFVec(origin, vOrigin);         vOrigin[2] += 4.0;                   createLadder( vOrigin );         client_print(id, print_chat, "* You Spawned Ladder, Have Fun! :-)");     } } public cmdDeleteLadder(id) {     if (get_user_flags(id) & ADMIN_KICK) {         new ent, body;         get_user_aiming(id, ent, body);                   if (isLadder(ent)) {             fm_remove_entity(ent);             client_print(id, print_chat, "* You Removed Ladder.");         }     } } createLadder( Float:vOrigin[3] ) {     new ent = fm_create_entity( "info_target" );           if (fm_is_valid_ent(ent)) {         set_pev(ent, pev_classname, "xpaw_ladder");         set_pev(ent, pev_solid, SOLID_BBOX);         set_pev(ent, pev_movetype, MOVETYPE_NONE);                   new Float:vSizeMin[3];         new Float:vSizeMax[3];         new Float:vAngles[3];         vSizeMin = gLadderMinY;         vSizeMax = gLadderMaxY;         vAngles[0] = 90.0;         vAngles[2] = 90.0;                   //adjust size min/max vectors depending on scale         for (new i = 0; i < 3; ++i) {             if (vSizeMin[i] != 4.0 && vSizeMin[i] != -4.0)                 vSizeMin[i] *= 1.0;                           if (vSizeMax[i] != 4.0 && vSizeMax[i] != -4.0)                 vSizeMax[i] *= 1.0;         }                   fm_entity_set_model(ent, MODEL);         set_pev(ent, pev_angles, vAngles);         fm_entity_set_size(ent, vSizeMin, vSizeMax);         fm_entity_set_origin(ent, vOrigin);                   return ent;     }           return 0; } bool:isLadder(ent) {     if (fm_is_valid_ent(ent)) {         new szClassname[32];         pev(ent, pev_classname, szClassname, 32);                   if (equal(szClassname, "xpaw_ladder"))             return true;     }     return false; }
BeasTeHbIw is offline
 



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

Forum Jump


All times are GMT -4. The time now is 09:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode