AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   first script idea? (https://forums.alliedmods.net/showthread.php?t=11136)

DarlD 03-10-2005 16:23

first script idea?
 
I got this idea for a frist script something that would start me up on the scripting community. i've got the idea but i have no idea on how to start it.

basicly i want to make it so that at each new round players are droped down at 1hp and they are given a scout with full ammo. basicly a one shot kill server. here is what i got so far...

Code:

/*
One shot kill, for Amx Mod X

Created by DarlD
*/
#include <amxmodx>
#include <fun>
#include <cstrike>

public plugin_init() // im starting my plugin here
{
    register_plugin("One shot kill","0.1","DarlD")

thats as far as i could go

EDIT: i think i made some progress but im almost sure i made errors!

Code:

/*
One shot kill, for Amx Mod X

Created by DarlD
*/
#include <amxmodx>
#include <fun>
#include <cstrike>

public plugin_init() // im starting my plugin here
{
    register_plugin("One shot kill","0.1","DarlD")
    register_cvar("amx_oneshot","1","1","1","1",1")
}

set_user_health(1,1)
give_item(32,weapon_scout)
give_item(32,ammo_scout)


XxAvalanchexX 03-10-2005 22:12

Code:
/* One shot kill, for Amx Mod X Created by DarlD */ #include <amxmodx> #include <fun> public plugin_init() // im starting my plugin here {     register_plugin("One shot kill","0.1","DarlD")     register_cvar("amx_oneshot","1")     register_event("ResetHUD","event_resethud","b"); } public event_resethud(id) { // when a user's HUD is reset    if(is_user_connected(id)) { // make sure they are connected (just to be sure)       // most of the time ResetHUD is called when       // a user spawns, but it can be called other times.       // when it IS called when they spawn, they are still       // technically dead. so we wait one tenth of a second       // to see if they alive, and if so it means they just       // spawned, which is when we want to do this.       set_task(0.1,"dostuff",id)    } } public dostuff(id) {    // if user is alive    if(is_user_alive(id)) {       set_user_health(id,1)       give_item(id,"weapon_scout")       give_item(id,"ammo_scout")    } }

manorastroman 03-10-2005 22:15

is there a way that you can mask how much health the client really has?

Peli 03-11-2005 00:21

LMAO I made a plugin exactly like this , I just didn't release it... If you want you can Private Message me and I'll show you the code with descriptions.

DarlD 03-11-2005 00:50

woha i was way off thanks man. i guess i release it under your name though. now i understand how it works a little better.

edit: i've tried to add the cs_set_user_money command in the script because if the player is able to buy other weapons it would kinda suck. so heres what i did and i get a compile error of course. where did i make an error?

Code:
/* One shot kill, for Amx Mod X Created by DarlD */ #include <amxmodx> #inculde <cstrike> #include <fun> public plugin_init() // im starting my plugin here {     register_plugin("One shot kill","0.1","DarlD")     register_cvar("amx_oneshot","1")     register_event("ResetHUD","event_resethud","b"); } public event_resethud(id) { // when a user's HUD is reset    if(is_user_connected(id)) { // make sure they are connected (just to be sure) }    cs_set_user_money(id,"0","0") {       // most of the time ResetHUD is called when       // a user spawns, but it can be called other times.       // when it IS called when they spawn, they are still       // technically dead. so we wait one tenth of a second       // to see if they alive, and if so it means they just       // spawned, which is when we want to do this.       set_task(0.1,"dostuff",id)    } } public dostuff(id) {    // if user is alive    if(is_user_alive(id)) {       set_user_health(id,1)       give_item(id,"weapon_scout")       give_item(id,"ammo_scout")    } }

DarlD 03-11-2005 14:06

could any one help me?

Johnny got his gun 03-11-2005 15:06

Look in the include/*.inc files for proper native syntax... (like cs_set_user_money())
(hint: cs_set_user_money(player, 0))

DarlD 03-11-2005 15:18

when i did that it gave me loads of errors :S

Code:
      set_task(0.1,"dostuff",id)    } } public dostuff(id) {    // if user is alive    if(is_user_alive(id)) {       set_user_health(id,1)       cs_set_user_money(player,"0")       give_item(id,"weapon_scout")       give_item(id,"ammo_scout")    } }

i just added cs_set_user_money and it doesnt work :S i added cstrike in the inculde though still gives an error

v3x 03-11-2005 16:16

Show the whole code, please :).

XxAvalanchexX 03-11-2005 21:02

Code:
/* One shot kill, for Amx Mod X Created by DarlD */ #include <amxmodx> #include <fun> public plugin_init() // im starting my plugin here {     register_plugin("One shot kill","0.1","DarlD")     register_cvar("amx_oneshot","1")     register_event("ResetHUD","event_resethud","b"); } public event_resethud(id) { // when a user's HUD is reset    if(is_user_connected(id)) { // make sure they are connected (just to be sure)       // most of the time ResetHUD is called when       // a user spawns, but it can be called other times.       // when it IS called when they spawn, they are still       // technically dead. so we wait one tenth of a second       // to see if they alive, and if so it means they just       // spawned, which is when we want to do this.       set_task(0.1,"dostuff",id)    } } public dostuff(id) {    // if user is alive    if(is_user_alive(id)) {       set_user_health(id,1)       give_item(id,"weapon_scout")       give_item(id,"ammo_scout")       cs_set_user_money(id,0);    } }


All times are GMT -4. The time now is 14:02.

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