Raised This Month: $51 Target: $400
 12% 

Beginner need help !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
windaub
Junior Member
Join Date: Mar 2006
Old 05-26-2006 , 13:59   Beginner need help !
Reply With Quote #1

Please could you tell me why this plugin doesn't work? I want to give a specific starmoney to the terrorist and another to the ct, i don't understand why this doesnt work!
Quote:
#include <amxmodx>
#include <cstrike>
#include <amxmisc>

new PLUGIN[]="Change Health"
new AUTHOR[]="Test Vince"
new VERSION[]="1.00"

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_money", "cmd_money", ADMIN_SLAY, "<moneyt> <moneyct>")
}

public cmd_money(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED

new Arg1[5]
new Arg2[5]

//Get the command arguments from the console
read_argv(1, Arg1, 4)
read_argv(2, Arg2, 4)

//Convert the money from a string to a number
new moneyyt = str_to_num(Arg1)
new moneyyct = str_to_num(Arg2)

new players[32], num
get_players(players, num)
new i
for (i=0; i<num; i++)
{
if (get_user_team(players[i]) == 1)
{
cs_set_user_money(players[i], moneyyt)
} else {
cs_set_user_money(players[i], moneyyct)
}
}
return PLUGIN_HANDLED
}
And I wish to make another plugin wish will write in the middle of the screen the distance of the closest ennemy, with the "client_prethink". I want to know if who the "id" designate too. Please excuse my english and ty for ur help!
windaub is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-26-2006 , 14:43  
Reply With Quote #2

You should read that before: http://forums.alliedmods.net/showthread.php?t=26363
VEN is offline
windaub
Junior Member
Join Date: Mar 2006
Old 05-26-2006 , 14:47   .
Reply With Quote #3

thanks for ur help really
windaub is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-26-2006 , 14:50  
Reply With Quote #4

He means post it like this:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "2Money" #define AUTHOR "Test Vince" #define VERSION "1.0" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_money", "cmd_money", ADMIN_SLAY, "<moneyt> <moneyct>") } public cmd_money(id, level, cid) {     if (!cmd_access(id, level, cid, 3))     {         return PLUGIN_HANDLED     }     new Arg1[5]     new Arg2[5]     //Get the command arguments from the console     read_argv(id, Arg1, 4)     read_argv(id, Arg2, 4)     //Convert the money from a string to a number     new moneyyt = str_to_num(Arg1)     new moneyyct = str_to_num(Arg2)     new players[32], num     get_players(players, num)     new i     for (i=0; i<num; i++)     {         if (get_user_team(players[i]) == 1)         {             cs_set_user_money(players[i], moneyyt)         }         else         {             cs_set_user_money(players[i], moneyyct)         }     }     return PLUGIN_HANDLED }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
VEN
Veteran Member
Join Date: Jan 2005
Old 05-26-2006 , 14:54  
Reply With Quote #5

Quote:
thanks for ur help really
Absolutely no need to be sarcastic here.

You want to get help? Then why didn't you bothered to make your post more readable for those who potentially may try to help you event after i directed you in the right side?
VEN is offline
windaub
Junior Member
Join Date: Mar 2006
Old 05-26-2006 , 15:18   re
Reply With Quote #6

thanks SweatyBanana but the server doesnt boot with this code :s
[EDIT] the server boots but the plugin doesnt work, its the same as before
windaub is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-26-2006 , 15:29  
Reply With Quote #7

EDIT: sry, read it wrong

EDIT2: tested the script in the first post and it worked fine, except that ur Arg1 and Arg2 arrays are too small
Code:
    new Arg1[6]     new Arg2[6]     //Get the command arguments from the console     read_argv(1, Arg1, 5)     read_argv(2, Arg2, 5)
__________________
plop
p3tsin is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-26-2006 , 15:57  
Reply With Quote #8



Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "2Money" #define AUTHOR "Test Vince" #define VERSION "1.0" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_money", "cmd_money", ADMIN_SLAY, "<moneyt> <moneyct>") } public cmd_money(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new Arg1[8]     new Arg2[8]         //Get the command arguments from the console     read_argv(1, Arg1, 7)     read_argv(2, Arg2, 7)         //Convert the money from a string to a number     new moneyyt = str_to_num(Arg1)     new moneyyct = str_to_num(Arg2)         new players[32], num     get_players(players, num)     for (new i=0; i<num; i++)     {         if (get_user_team(players[i]) == 1)             cs_set_user_money(players[i], moneyyt)         else             cs_set_user_money(players[i], moneyyct)     }     return PLUGIN_HANDLED } public client_PreThink(id) {     new iTarget,iBody     get_user_aiming(id,iTarget,iBody,200)         if(!iTarget)         return PLUGIN_CONTINUE         new iMoney = cs_get_user_money(iTarget),szName[33],szMessage[128]     get_user_name(iTarget,szName,32)         format(szMessage,127,"%s: $%i",szName,iMoney)         set_hudmessage(200,100,0,0.5,0.5,0,0.1,0.1,0.1,0.1,4)     show_hudmessage(id,"%s",szMessage)         return PLUGIN_CONTINUE }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 06:45.


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