29.12.2008, 22:55
Hello,
I was trying to make this thingy like when you get killed you spec the killer for like 10 second and then spawn again, but it doesent even show the killer it just points the vies to god knows where and you dont spawn after 10 second
This is the code
Can anybody help ?
I was trying to make this thingy like when you get killed you spec the killer for like 10 second and then spawn again, but it doesent even show the killer it just points the vies to god knows where and you dont spawn after 10 second
This is the code
pawn Код:
#include <a_samp>
//------------------------------------------------------------------------------
#define KILLER_SPEC_TYPE_PLAYER 0
#define KILLER_SPEC_TYPE_NONE 1
//------------------------------------------------------------------------------
new gSpectateID[MAX_PLAYERS];
new gSpectateType[MAX_PLAYERS];
new CountdownTime = 10,CountdownTimer,CTime;
forward Countdown();
//------------------------------------------------------------------------------
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
new x = 0;
while(x!=MAX_PLAYERS) {
if( IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
gSpectateID[x] == playerid && gSpectateType[x] == KILLER_SPEC_TYPE_PLAYER )
{
SetPlayerInterior(x,newinteriorid);
}
x++;
}
}
//------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
new speckillerid;
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, speckillerid);
SetPlayerInterior(playerid,GetPlayerInterior(speckillerid));
gSpectateID[playerid] = speckillerid;
gSpectateType[playerid] = KILLER_SPEC_TYPE_PLAYER;
return 1;
}
//------------------------------------------------------------------------------
public Countdown()
{
new playerid;
CountdownTimer = SetTimer("Countdown",1000,1);
CTime = CountdownTime;
if(CTime == 0) {
CTime = CountdownTime;
KillTimer(CountdownTimer); }
CTime--;
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = KILLER_SPEC_TYPE_NONE;
}