PHP Code:
#include <amxmodx>
#include <colorchat>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
public plugin_init()
{
register_clcmd("say /ct", "cmdCounterTerrorist");
register_clcmd("say_team /ct", "cmdCounterTerrorist");
register_clcmd("say /spec", "cmdSpectator");
register_clcmd("say_team /spec", "cmdSpectator");
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET);
}
public cmdSpectator(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR){
return PLUGIN_HANDLED;
}
user_silentkill(id);
cs_set_user_team(id, CS_TEAM_SPECTATOR);
new namex[32];
get_user_name(id, namex, 31);
ColorChat(0, GREEN, "^x04[KZ] %s has been switched to the SPECTATORS by request.", namex);
return PLUGIN_CONTINUE;
}
public cmdCounterTerrorist(id)
{
if(cs_get_user_team(id) == CS_TEAM_CT){
return PLUGIN_HANDLED;
}
cs_set_user_team(id, CS_TEAM_CT);
ExecuteHamB(Ham_CS_RoundRespawn, id);
if(!user_has_weapon(id, CSW_KNIFE)){
fm_give_item(id, "weapon_knife");
}
if(!user_has_weapon(id, CSW_USP)){
fm_give_item(id, "weapon_usp");
}
new namex[32];
get_user_name(id, namex, 31);
ColorChat(0, GREEN, "^x04[KZ] %s has been switched to the CT by request", namex);
return PLUGIN_CONTINUE;
}
fm_give_item(id, const item[])
{
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if(!pev_valid(ent)){
return 0;
}
new Float:origin[3];
pev(id, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, id);
if(pev(ent, pev_solid ) != save){
return ent;
}
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
When player write
"/cp" > "/spec" > "/ct" (player spawn on his checkpoint) its ok
but...
My problem is, when player write
"/spec" > "/ct" , he spawn on CT spawn!
Need, when player write
"/spec" > "/ct" , he spawn on place where he write "/spec"