Quote:
Originally Posted by fysiks
That doesn't transfer xp. It just sets xp for the target. You need to check for number of arguments also.
Also, don't do it for him (especially when you do it wrong). This forum is called "Scripting Help" and not "Do This For Me Forum".
|
oh yeah, sorry.
i was on ohter world or something when i writed the code.
Did not readed the topic carefully.
anyway here it is!
PHP Code:
public plugin_init ()
{
register_clcmd ( "xpmod_give_xp", "transfer_xp") // register that command
}
public transfer_xp(id)
{
new name[32], xpamount[32], target
read_argv(1, name, charsmax (name)) // get name from saytext arg " xpmod_give_xp [name] [] "
read_argv(2, xpamount, charsmax (xpamount)) // get xpamount from saytext arg " xpmod_give_xp [] [amount] "
target = cmd_target (id, name, 3) // now get the target by the name what was in saytext arg
if (!target && g_yourxpvariable[id] > xpamount - 1 ) // check if there is a target and
return PLUGIN_HANDLED // check that transfer player have enough xp to sent it
g_yourxpvariable[target] += xpamount // give xp to target
g_yourxpvariable[id] -= xpamount // take xp from transfer player
return PLUGIN_HANDLED
}
oh bytheway, and i explained what my code does this time, if you noticed.
It is very nice way to learn scripting, so i helped him with scripting.