Raised This Month: $ Target: $400
 0% 

Carmod Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tykes
Member
Join Date: Feb 2006
Old 04-18-2006 , 03:38   Carmod Help
Reply With Quote #1

This is the part where you touch the car. (register_touch("item_car","player","setcar") )




Code:
public item_car() {
   new arg[33], arg2[33], itemstr[33], arg4[33]
   read_argv(1,arg,32)
   read_argv(2,arg2,32)
   read_argv(3,itemstr,32)
   read_argv(4,arg4,32)
   new id = str_to_num(arg)
   new itemid = str_to_num(arg2)
   speed[id] = str_to_num(arg4)
   
   if(incar[id] || carout[id]) {
      client_print(id,print_chat,"[CarMod] You've deleted your car.")
      set_item_amount(id,"+",itemid,1,"money")
      if(incar[id]) {
         new name[64]
         get_user_name(id,name,63)
         new message[300]
         format(message,299,"[CarMod] %s has turned off his engine and got out of the car.",name)
         overhear(id,300,message)
         client_cmd(id, "cl_forwardspeed %i;cl_sidespeed %i;cl_backwardspeed %i",oldspeed,oldspeed,oldspeed)
         set_user_info(id,"model",oldmodel[id])
         incar[id] = 0
      }
      if(carout[id]) {
         remove_entity(carout[id])
         set_item_amount(id,"+",itemid,1,"money")
      }
   }
   else {
      set_item_amount(id,"+",itemid,1,"money")
      if(allow[id] != 0) return PLUGIN_HANDLED
      
      new name[64]
      get_user_name(id,name,63)
      new message[300]
      format(message,299,"[CarMod] %s has gotten into his car and started the engine.",name)
      overhear(id,300,message)
      client_print(id,print_chat,"[CarMod] You have gotten into your car and started the engine.")
      get_user_info(id,"model",oldmodel[id], 32)
      
      carmodel[id] = itemstr
      set_user_info(id,"model",itemstr)
      client_cmd(id, "cl_forwardspeed %i;cl_sidespeed %i;cl_backwardspeed %i",speed[id],speed[id],speed[id])
      
      incar[id] = 1
      carout[id] = 0
      emit_sound(id, CHAN_ITEM, "carmod/start.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)   
   }
   return PLUGIN_HANDLED
}
That is item_car.


This is setcar.


Code:
public setcar(entid,id) {
   if(allow[id] != 0) return PLUGIN_HANDLED
   if(incar[id] != 0) return PLUGIN_HANDLED
   
   new locked[33], authid[33]
   entity_get_string(entid,EV_SZ_target,locked,32)
   get_user_authid(id,authid,32)
   if(!equal(locked,"") || !equal(locked,authid)) return PLUGIN_HANDLED
   new name[64]
   get_user_name(id,name,63)
   new message[300]
   format(message,299,"[CarMod] %s has gotten into his car and started the engine.",name)
   overhear(id,300,message)
   client_print(id,print_chat,"[CarMod] You have gotten into your car and started the engine.")
   get_user_info(id,"model",oldmodel[id], 32)
   
   new itemstr[33]
   entity_get_string(entid,EV_SZ_targetname,itemstr,32)
   
   carmodel[id] = itemstring
   set_user_info(id,"model",itemstr)
   oldfric[id] = entity_get_float(id,EV_FL_friction)
   speed[id] = entity_get_int(id,EV_INT_team)
   client_cmd(id, "cl_forwardspeed %i;cl_sidespeed %i;cl_backwardspeed %i",speed[id],speed[id],speed[id])
   entity_set_float(id,EV_FL_friction,0.3)
   
   incar[id] = 1
   carout[id] = 0
   emit_sound(id, CHAN_ITEM, "carmod/start.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
   remove_entity(entid)
   return PLUGIN_HANDLED
}




The problem is, in game, I can't get into the car.
Tykes is offline
Send a message via AIM to Tykes
Tykes
Member
Join Date: Feb 2006
Old 04-18-2006 , 23:08  
Reply With Quote #2

bump
Tykes is offline
Send a message via AIM to Tykes
Reply



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 05:06.


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