OnPlayerDeath and OnPlayerSpawn -
user226 - 19.06.2009
Hello, tell me please:
I need to:
The player on cmd, teleported in coord X, y, z
After entering the command, if he died, he next three spawn in x.y.z, and so 3 times. and then as usual
Re: OnPlayerDeath and OnPlayerSpawn -
hazdog - 20.06.2009
in english please
Re: OnPlayerDeath and OnPlayerSpawn -
user226 - 20.06.2009
Edit 1 Post
better?
Understand?
Re: OnPlayerDeath and OnPlayerSpawn -
Joe Staff - 20.06.2009
I understand
pawn Код:
new deathcount[MAX_PLAYERS];
new SpawnPos[4][MAX_PLAYERS];
//OnPlayerCommandText
if(strcmp(cmdtext,"/command",true)==0)
{
GetPlayerPos(playerid,SpawnPos[0][playerid],SpawnPos[1][playerid],SpawnPos[2][playerid]);
GetPlayerFacingAngle(playerid,SpawnPos[3][playerid]);
deathcount[playerid]=3;
return SendClientMessage(playerid,0xFF0000FF,"You will now spawn here 3 more times.");
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate==PLAYER_STATE_SPAWNED)
{
if(deathcount[playerid]>0)
{
SetPlayerPos(playerid,SpawnPos[0][playerid],SpawnPos[1][playerid],SpawnPos[2][playerid]);
SetPlayerFacingAngle(playerid,SpawnPos[3]);
deathcount[playerid]--;
}
}
}
Re: OnPlayerDeath and OnPlayerSpawn -
user226 - 20.06.2009
This will act if the player will press a key after the command-and-death, right? or keystroke does not necessarily?
Re: OnPlayerDeath and OnPlayerSpawn -
user226 - 20.06.2009
SilentHuntr,
pawn Код:
#include <a_samp>
new deathcount[MAX_PLAYERS];
//new SpawnPos[4][MAX_PLAYERS];
new Float:SpawnPos[][4] =
{
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
}
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Sumo");
print("----------------------------------\n");
}
#endif
public OnFilterScriptInit()
{
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmdtext,"/cmd",true)==0)
{
GetPlayerPos(playerid,SpawnPos[0][playerid],SpawnPos[1][playerid],SpawnPos[2][playerid]);
deathcount[playerid]=3;
return SendClientMessage(playerid,0xFF0000FF,"You will now spawn here 3 more times.");
}
return 0;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate==PLAYER_STATE_SPAWNED)
{
if(deathcount[playerid]>0)
{
SetPlayerPos(playerid,SpawnPos[0][playerid],SpawnPos[1][playerid],SpawnPos[2][playerid]);
deathcount[playerid]--;
}
}
}
when I write /cmd, all server lag..
Re: OnPlayerDeath and OnPlayerSpawn -
Joe Staff - 20.06.2009
What that does is makes the player's coordinate his new spawn spot.
Re: OnPlayerDeath and OnPlayerSpawn -
user226 - 20.06.2009
Sorry please ..
But I poorly understand what you said ..
Write what needs to be corrected in my code please
Re: OnPlayerDeath and OnPlayerSpawn -
user226 - 20.06.2009
help me please........
Re: OnPlayerDeath and OnPlayerSpawn -
Grim_ - 20.06.2009
Something like this..
pawn Код:
enum Last
{
Float:LastX,
Float:LastY,
Float:LastZ,
Float:LastA,
}
new Info[MAX_PLAYERS][Last];
new deathcount[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/command", true) == 0)
{
GetPlayerPos(playerid, Info[playerid][LastX], Info[playerid][LastY], Info[playerid][LastZ]);
GetPlayerFacingAngle(playerid, Info[playerid][LastA]);
SendClientMessage(playerid, color, "You will now spawn here 3 times!");
deathcount[playerid] = 3;
return 1;
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(deathcount[playerid] > 0)
{
deathcount[playerid] --;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(deathcount[playerid] > 0)
{
SetPlayerPos(playerid, Info[playerid][LastX], Info[playerid][LastY], Info[playerid][LastZ]);
SetPlayerFacingAngle(playerid, Info[playerid][LastA]);
}
return 1;
}