Quote:
Originally Posted by psychonic
I don't know. I'll look into it later. The entity probably just needs some setup after creating it, before spawn. (setting the model, etc.)
|
i created a function to spawn the identity at the origin of the marine, no problem, but when i use ur function, it crashed the game right away... here's my code...
PHP Code:
public Action:Spawn_Entity(client, args)
{
if (args < 2 || args > 2)
{
ReplyToCommand(client, "[SM] spawn <playerid> <entity classname> - Spawn <entity classname> at <playerid>'s marine origin.");
return Plugin_Handled;
}
else
{
decl String:argstring1[5], String:argstring2[30], clientid, marineid, weapon;
GetCmdArg(1, argstring1, sizeof(argstring1));
GetCmdArg(2, argstring2, sizeof(argstring2));
clientid = StringToInt(argstring1);
if (clientid < 1 || clientid > MaxClients)
{
ReplyToCommand(client, "[SM] Player index is out of valid range.");
return Plugin_Handled;
}
weapon = CreateEntityByName(argstring2);
if(IsValidEntity(weapon))
{
DispatchSpawn(weapon); //Spawn weapon (entity)
marineid = Swarm_GetMarine(clientid);
decl Float:position[3];
GetEntPropVector(marineid, Prop_Send, "m_vecOrigin", position);
TeleportEntity(weapon, position, NULL_VECTOR, NULL_VECTOR);
if (client == 0)
{
ReplyToCommand(client, "Spawned %s and teleported to %N's position.", argstring2, clientid);
return Plugin_Handled;
}
PrintToChat(client, "Spawned %s and teleported to %N's position.", argstring2, clientid);
return Plugin_Handled;
}
else
{
if (client == 0)
{
ReplyToCommand(client, "Invalid weapon classname entered.");
return Plugin_Handled;
}
PrintToChat(client, "Invalid weapon classname entered.");
}
return Plugin_Handled;
}
}
and also, is there any way to respawn a marine? it will be very good if one can respawn a marine that is killed in action...
EDIT 2: error on your Swarm_MarineForceSuicide function...
PHP Code:
] killmarine 1
L 12/03/2010 - 12:04:00: [SM] Native "Swarm_ForceMarineSuicide" reported: Suicide function not found
L 12/03/2010 - 12:04:00: [SM] Displaying call stack trace for plugin "ready.smx":
L 12/03/2010 - 12:04:00: [SM] [0] Line 58, ready.sp::Kill_Player_Marine()
here's my code:
PHP Code:
public Action:Kill_Player_Marine(client, args)
{
if (args < 1 || args > 1)
{
ReplyToCommand(client, "[SM] killmarine <playerid> - Slays <playerid>'s marine.");
return Plugin_Handled;
}
else
{
decl String:argstring1[5], clientid, marineid;
GetCmdArg(1, argstring1, sizeof(argstring1));
clientid = StringToInt(argstring1);
if (clientid < 1 || clientid > MaxClients)
{
ReplyToCommand(client, "[SM] Player index is out of valid range.");
return Plugin_Handled;
}
marineid = Swarm_GetMarine(clientid);
Swarm_ForceMarineSuicide(marineid);
if (client == 0)
{
ReplyToCommand(client, "Slayed %N's marine.", clientid);
return Plugin_Handled;
}
PrintToChat(client, "Slayed %N's marine.", clientid);
return Plugin_Handled;
}
}