Raised This Month: $ Target: $400
 0% 

Need help with my first script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 03:01   Need help with my first script
Reply With Quote #1

Hi everybody, It's my first script, so don't call me n00b (I'm a n00b, as you can see, but don't tell me)

Code:
--------------------------------------------------------------------------------- /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <dbi> #include <tsx> #include <engine> #include <engine_stocks> #include <fun> #include <tsxaddon> #define PLUGIN "Matrix Phone" #define VERSION "1.0" #define AUTHOR "Kuidao Ketemeto" public plugin_init() {     register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")         register_srvcmd("item_mphone","item_mphone")         // Add your code here... } // Precaching some stuff public plugin_precache() {     precache_sound("items/kuidao/teleport.wav") } //////////////////////////////////// //      ITEM /////////////////////////////////// // The Matrix Phone public item_mphone(id) {   new origin[3]   new authid[32]         get_user_authid(id,authid,31)     get_user_origin(id,origin)     origin[0] = -326 // X coordinates     origin[1] = 152 // Y coordinates     origin[2] = -25 // Z coordinates     set_user_origin(id,origin)   // Moves the player to the location stored in origin     client_cmd(id,"speak ^"items/kuidao/teleport^"")     return PLUGIN_HANDLED } -----------------------------------------------------------------------------------

When I compile it, I have 2 warnings in files 41 and 47...

It's a TSRP plugin, workin with Harbu's.
When I use that item in the server, it plays the sound, but doesn't teleport me, in the server console I can see this:

-----------------------------------------------
L 05/05/2006 - 07:56:22: [AMXX] Native error in "get_user_origin" on line 42 (file "matrix_phone.sma").
-----------------------------------------------

Please help me


(I'm Spanish, sorry my english)
kuidao is offline
Send a message via AIM to kuidao
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-05-2006 , 06:35  
Reply With Quote #2

u registered "item_mphone" as a servercommand, so there won't be an id passed into the function (it will be 0)
use register_clcmd instead

(btw, engine_stocks.inc is already included in engine.inc)
__________________
plop
p3tsin is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-05-2006 , 08:51  
Reply With Quote #3

You don't need all those included and to the person above me it's for tsrp i'm guessing so he needs to use server command
wonsae is offline
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 09:26  
Reply With Quote #4

[small]
---------------------------------------------------------------------------------
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <dbi>
#include <tsx>
#include <engine>
#include <engine_stocks>
#include <fun>
#include <tsxaddon>

#define PLUGIN "Matrix Phone"
#define VERSION "1.0"
#define AUTHOR "Kuidao Ketemeto"


public plugin_init() {
register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")

register_clcmd("item_mphone","item_mphone")

// Add your code here...
}

// Precaching some stuff
public plugin_precache()
{
precache_sound("items/kuidao/teleport.wav")
}

////////////////////////////////////
// ITEM
///////////////////////////////////

// The Matrix Phone
public item_mphone(id)
{
new origin[3]
new authid[32]

get_user_authid(id,authid,31)
get_user_origin(id,origin)
origin[0] = -326 // X coordinates
origin[1] = 152 // Y coordinates
origin[2] = -25 // Z coordinates
set_user_origin(id,origin) // Moves the player to the location stored in origin
client_cmd(id,"speak ^"items/kuidao/teleport^"")
return PLUGIN_HANDLED
}
-----------------------------------------------------------------------------------
[small]

but now it's no working, the warnings are the same, but now is not working
kuidao is offline
Send a message via AIM to kuidao
Rixorster
Senior Member
Join Date: Jul 2005
Old 05-05-2006 , 09:42  
Reply With Quote #5

Hmm, maybe, try to put this in the top(after #define's)
Code:
new Float:porigin[3] = { -326.0, 152.0, -25.0 }
And then:
Code:
set_user_origin(id,porigin)
Lemme write the full code <.<
Edit:Here:
Code:
// Edited by Rixorster #include <amxmodx> #include <amxmisc> #include <engine> #include <fun> new Float:porigin[3] = { -326.0, 152.0, -25.0 } public plugin_init() {     register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")         register_clcmd("item_mphone","item_mphone")         // Add your code here... } // Precaching some stuff public plugin_precache() {     precache_sound("items/kuidao/teleport.wav") } //////////////////////////////////// //        ITEM /////////////////////////////////// // The Matrix Phone public item_mphone(id) {   new origin[3]   new authid[32]         get_user_authid(id,authid,31)     get_user_origin(id,origin)     set_user_origin(id,porigin)   // Moves the player to the location stored in origin     client_cmd(id,"speak ^"items/kuidao/teleport^"")     return PLUGIN_HANDLED } -----------------------------------------------------------------------------------
Untested, but should work.
Edit: Fixage, forgot one thing <.<
Edit:Fixed
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 10:11   no
Reply With Quote #6

It doesn't work anyway...

Now the warnings are:

<34> : warning 217: loose identation

and

<37> : warning 213: tag mismatch

And now it's no workin, NOTHING, no errors in server console...


// EDIT:

I wrote register_srvcmd again, and it plays the sound and I get this error in console:

[AMXX] Native error in "get_user_origin" on line 36 (file "matrix_phone.sma").
kuidao is offline
Send a message via AIM to kuidao
Rixorster
Senior Member
Join Date: Jul 2005
Old 05-05-2006 , 12:18  
Reply With Quote #7

Yep, i know that, i get it around many scripts, got no idea what it means but doesn't matter for me
Anyways, this should work fine.
Code:
// Edited by Rixorster #include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #include <fakemeta> new Float:porigin[3] = { -326.0, 152.0, -25.0 } public plugin_init() {     register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")     register_clcmd("item_mphone","item_mphone") } // Precaching some stuff public plugin_precache() {     precache_sound("items/kuidao/teleport.wav") } //////////////////////////////////// //        ITEM /////////////////////////////////// // The Matrix Phone public item_mphone(id) {     new Origin[3]     get_user_origin(id,Origin)     new authid[32]     get_user_authid(id,authid,31)     set_user_origin(id,porigin)   // Moves the player to the location stored in origin     client_cmd(id,"speak ^"items/kuidao/teleport^"")     return PLUGIN_HANDLED }
But i don't get one thing, why you have that authid thing there? <.<
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 13:39  
Reply With Quote #8

well, I don't know, but look:

[AMXX] Native error in "get_user_origin" on line 30 (file "matrix_phone.sma").

But now I have only 1 warning!

<33> : warning 213: tag mismatch
kuidao is offline
Send a message via AIM to kuidao
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 14:07  
Reply With Quote #9

[small]
----------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>

new porigin[3] = { -326, 152, -25 }


public plugin_init() {
register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")
register_clcmd("item_mphone","item_mphone")
}

// Precaching some stuff
public plugin_precache()
{
precache_sound("items/kuidao/teleport.wav")
}

////////////////////////////////////
// ITEM
///////////////////////////////////

// The Matrix Phone
public item_mphone(id)
{
set_user_origin(id, porigin) // Moves the player to the location stored in origin
client_cmd(id,"speak ^"items/kuidao/teleport^"")
return PLUGIN_HANDLED
}
----------------------------------------------
[small]

ok, Sean D told me to do this, well, thanks, no warnings anymore...

I edited this:

[small]

register_clcmd("item_mphone","item_mphone")

[small]

to this:

[small]

register_srvcmd("item_mphone","item_mphone")

[small]

and now the sound works, if I use the clcmd, nothin works.

But I have a problem, this one that comes in server's console:

[AMXX] Native error in "set_user_origin" on line 28 (file "matrix_phone.sma").


We are going to make it, I'll give all you some karma!

hey, how to give karma?
kuidao is offline
Send a message via AIM to kuidao
kuidao
Junior Member
Join Date: May 2006
Old 05-05-2006 , 14:18  
Reply With Quote #10

[small]
----------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>

new porigin[3] = { -326, 152, -25 }


public plugin_init() {
register_plugin("Matrix Phone", "1.0", "Kuidao Ketemeto")
register_clcmd("item_mphone","item_mphone")
}

// Precaching some stuff
public plugin_precache()
{
precache_sound("items/kuidao/teleport.wav")
}

////////////////////////////////////
// ITEM
///////////////////////////////////

// The Matrix Phone
public item_mphone(id)
{
set_user_origin(id, porigin) // Moves the player to the location stored in origin
client_cmd(id,"speak ^"items/kuidao/teleport^"")
return PLUGIN_HANDLED
}
----------------------------------------------
[small]

ok, Sean D told me to do this, well, thanks, no warnings anymore...

I edited this:

[small]

register_clcmd("item_mphone","item_mphone")

[small]

to this:

[small]

register_srvcmd("item_mphone","item_mphone")

[small]

and now the sound works, if I use the clcmd, nothin works.

But I have a problem, this one that comes in server's console:

[AMXX] Native error in "set_user_origin" on line 28 (file "matrix_phone.sma").


We are going to make it, I'll give all you some karma!
kuidao is offline
Send a message via AIM to kuidao
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 05:05.


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