AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Beginner need help ! (https://forums.alliedmods.net/showthread.php?t=28956)

windaub 05-26-2006 13:59

Beginner need help !
 
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!

VEN 05-26-2006 14:43

You should read that before: http://forums.alliedmods.net/showthread.php?t=26363

windaub 05-26-2006 14:47

.
 
thanks for ur help really

SweatyBanana 05-26-2006 14:50

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 }

VEN 05-26-2006 14:54

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?

windaub 05-26-2006 15:18

re
 
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

p3tsin 05-26-2006 15:29

EDIT: sry, read it wrong :oops:

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)

Hawk552 05-26-2006 15:57

:arrow:

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 }


All times are GMT -4. The time now is 16:18.

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