AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   adding a player's origin (https://forums.alliedmods.net/showthread.php?t=26265)

wonsae 03-29-2006 16:43

adding a player's origin
 
hi i'm trying to add a player origin on this so the command would be
amx_createcar <target> <model>
so then the model spawns ontop of them but this wouldnt work
help plz
Code:
public purposedrop(id)     {     if(!is_user_alive(id)) return PLUGIN_HANDLED     if(!access(id,ADMIN_RESERVATION)) return PLUGIN_HANDLED         new itemname[64], player[32], target     read_argv(1, itemname, 31)     read_argv(3, player, 31)     if(!access(id,ADMIN_RESERVATION)) {         client_print(id,print_console,"You do not have access to this command.")         return PLUGIN_HANDLED     }     if(equal(itemname, ""))         if(equal(player, ""))         {         client_print(id,print_console,"Usage: amx_createcar <target> <model>")         return PLUGIN_HANDLED     }         new origin[3], Float:originF[3], Float:angles[3]     get_user_origin(id,origin)     target = cmd_target(id,player,2)         if(!target) {         return PLUGIN_HANDLED     }     entity_get_vector(target,EV_VEC_origin, origin)     entity_get_vector(target,EV_VEC_angles, angles)         originF[0] = float(origin[0])     originF[1] = float(origin[1])     originF[2] = float(origin[2])         new car = create_entity("info_target")         if(!car) {         client_print(id,print_chat,"CAR WAS not created. Error.^n")         return PLUGIN_HANDLED     }         new Float:minbox[3] = { -2.5, -2.5, -2.5 }     new Float:maxbox[3] = { 2.5, 2.5, -2.5 }         new Float:pangles[3]     entity_get_vector(id,EV_VEC_angles,pangles)     angles[1] = pangles[1]     entity_set_vector(car,EV_VEC_mins,minbox)     entity_set_vector(car,EV_VEC_maxs,maxbox)     entity_set_vector(car,EV_VEC_angles,angles)     entity_set_float(id,EV_FL_speed,100.0)     entity_set_float(car,EV_FL_dmg,0.0)     entity_set_float(car,EV_FL_dmg_take,0.0)     entity_set_float(car,EV_FL_max_health,99999.0)     entity_set_float(car,EV_FL_health,99999.0)         entity_set_int(car,EV_INT_solid,SOLID_TRIGGER)     entity_set_int(car,EV_INT_movetype,MOVETYPE_NONE)         entity_set_string(car,EV_SZ_targetname,itemname)     entity_set_string(car,EV_SZ_classname,"item_car")         new damodel[64]     format(damodel,63,"models/player/%s/%s.mdl", itemname, itemname)         entity_set_model(car,damodel)     entity_set_origin(car,originF)         allow[id] = 1     set_task(10.0,"allowhim",id)     return PLUGIN_HANDLED }

ObscureAlucard 03-29-2006 23:12

Re: adding a player's origin
 
Quote:

Originally Posted by wonsae
hi i'm trying to add a player origin on this so the command would be
amx_createcar <target> <model>
so then the model spawns ontop of them but this wouldnt work
help plz
Code:
public purposedrop(id)     {         new itemname[64], player[32], target     read_argv(1, itemname, 31)     read_argv(3, player, 31)     }

Well for one, your itemname len is wrong, it should be 63, not 31 by the way you have it

v3x 03-30-2006 00:10

Code:
    new Float:originF[3], Float:angles[3]     //get_user_origin(id, origin)     target = cmd_target(id, player, 2)         if(!target) {         return PLUGIN_HANDLED     }     entity_get_vector(target, EV_VEC_origin, originF)     entity_get_vector(target, EV_VEC_angles, angles)     originF[2] += 75.0 // or something

wonsae 03-30-2006 16:26

thanks i'm gonna go try it

wonsae 04-01-2006 09:25

ok i tried this and it didn't work when i tried to target someone it said client not found


All times are GMT -4. The time now is 10:07.

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