AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   User Spawn not working (https://forums.alliedmods.net/showthread.php?t=22917)

Des12 01-06-2006 20:57

User Spawn not working
 
I am trying to make a plugin print "You have spawned" when a player spawns, and teleport that player twice if he has a certain steamid. All it has managed to do is give a 1/4 chance of server crashing everytime someone spawns.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> public plugin_init() {     register_plugin("User Spawn","v1","Dest Romano")         register_event("ResetHUD","Event_ResetHUD","b")     } public Event_ResetHUD(id) {     client_print(id, print_chat, "[AMXX] You have respawned!")     new authid[32]     get_user_authid(id,authid,31)     if(equali(authid,"STEAM_0:0:4644907"))     {     new origin1[3] = { -554, 3636, 364 }     set_user_origin(id, origin1)     set_task(0.1,"tele2",id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public tele2(id) {     new origin2[3] = { -1332, 3417, 196 }     set_user_origin(id, origin2)     return PLUGIN_HANDLED }

No compile errors either.

Hawk552 01-06-2006 21:22

Probably because you're using ResetHUD, which is called more than just by respawning.

It's not safe to use really, but here, try this:

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> public plugin_init() {     register_plugin("User Spawn","v1","Dest Romano")         register_event("ResetHUD","Event_ResetHUD","be") } public Event_ResetHUD(id) {     if(!is_user_alive(id))     {         return PLUGIN_HANDLED     }         client_print(id, print_chat, "[AMXX] You have respawned!")         new authid[32]     get_user_authid(id,authid,31)     if(equali(authid,"STEAM_0:0:4644907"))     {         new origin1[3] = { -554, 3636, 364 }         set_user_origin(id, origin1)         set_task(0.1,"tele2",id)     }         return PLUGIN_HANDLED } public tele2(id) {     new origin2[3] = { -1332, 3417, 196 }     set_user_origin(id, origin2)     return PLUGIN_HANDLED }

Des12 01-06-2006 22:38

Thank you!


All times are GMT -4. The time now is 15:44.

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