Spec bug
#1

hello guys i'm developing a gamemode wich is DM RACE ,
when the player die he should be specing other players till the race finish but the problem is that the player doesn't spec when he die but he spawn !

tried this but still not working

PHP код:
public OnPlayerDeath(playeridkilleridreason){
    if(
GetServerCount() > 1)
    {
        
SetPVarInt(playerid"Dead"1);
        
PlayerSpectateVehicle(playeridGetRandomPlayer(playerid));
    } else
    if(
GetServerCount() == 1)
    {
        
ProgressForMap();
    }
    return 
true;

Reply
#2

TogglePlayerSpectating MUST be used first.

https://sampwiki.blast.hk/wiki/PlayerSpectateVehicle

Also you are spectating a vehicle, why selecting a random player?
Reply
#3

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
TogglePlayerSpectating MUST be used first.

https://sampwiki.blast.hk/wiki/PlayerSpectateVehicle

Also you are spectating a vehicle, why selecting a random player?
Ye it's spectating a vehicle
Reply
#4

I am not sure but try:

PHP код:
public OnPlayerDeath(playeridkilleridreason){ 
    if(
GetServerCount() > 1
    { 
        
SetPVarInt(playerid"Dead"1);
        
TogglePlayerSpectating(playerid1);
        
PlayerSpectateVehicle(playeridGetRandomPlayer(playerid)); 
    } else 
    if(
GetServerCount() == 1
    { 
        
ProgressForMap(); 
    } 
    return 
true

Reply
#5

Quote:
Originally Posted by ChristolisTV
Посмотреть сообщение
I am not sure but try:

PHP код:
public OnPlayerDeath(playeridkilleridreason){ 
    if(
GetServerCount() > 1
    { 
        
SetPVarInt(playerid"Dead"1);
        
TogglePlayerSpectating(playerid1);
        
PlayerSpectateVehicle(playeridGetRandomPlayer(playerid)); 
    } else 
    if(
GetServerCount() == 1
    { 
        
ProgressForMap(); 
    } 
    return 
true

i tried that too but i show you a place like when server is connecting , the player dont' spawn anymore
Reply
#6

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
TogglePlayerSpectating MUST be used first.

https://sampwiki.blast.hk/wiki/PlayerSpectateVehicle

Also you are spectating a vehicle, why selecting a random player?
Can you please be more specific
Reply
#7

You want to spectate the vehicle of a random player, right? What if that "random player" is not in a vehicle or is also spectating someone? You have to think of a way to deal with that.
Reply
#8

Quote:
Originally Posted by Nixtren
Посмотреть сообщение
You want to spectate the vehicle of a random player, right? What if that "random player" is not in a vehicle or is also spectating someone? You have to think of a way to deal with that.
you're right , i couldn't do that that's why i requested help !

here are the codes

PHP код:
public OnPlayerSpawn(playerid){
    if(
ServerData[Started] == true) {
    
SetPVarInt(playerid"Dead"1);
    if(
GetServerCount() > 1){
    
PlayerSpectateVehicle(playeridGetRandomPlayer(playerid));}
    }
    else if(
ServerData[Loading] == true) {
    
SetPVarInt(playerid"Spawned"1);
    
TextDrawShowForPlayer(playeridMapText);
    
TextDrawShowForPlayer(playeridGecenSurem[playerid]);
    
TextDrawShowForPlayer(playeridSpectateYou[playerid]);
    
DisableRemoteVehicleCollisions(playeridtrue);
    }
    else if(
GetServerCount() == 0) return 0;
    if(
GetServerCount() >= 1)
    {
        if(
ServerData[Started] == false)
        {
            if(
ServerData[Loading] == true) return 0;
            
ProgressForMap();
           }
        }
    
SetPVarInt(playerid"Spawned"1);
    
TextDrawShowForPlayer(playeridMapText);
    
TextDrawShowForPlayer(playeridGecenSurem[playerid]);
    
TextDrawShowForPlayer(playeridSpectateYou[playerid]);
    
DisableRemoteVehicleCollisions(playeridtrue);
    return 
1;

PHP код:
public OnPlayerDeath(playeridkilleridreason){
    if(
GetServerCount() > 1)
    {
        
SetPVarInt(playerid"Dead"1);
        
TogglePlayerSpectating(playerid1);
        
PlayerSpectateVehicle(playeridGetRandomPlayer(playerid));
    } else
    if(
GetServerCount() == 1)
    {
        
ProgressForMap();
    }
    return 
true;

Reply
#9

i hope that someone could help me
PHP код:
forward ServerData_AlivePlayers();public ServerData_AlivePlayers(){
    if(
GetAliveCount() == 0)
    {
        for(new 
0MAX_PLAYERSi++){
        if(
IsPlayerConnected(i)){
        if(
Spectekiler[i] == 1){ StopSpectate(i); }
        
TogglePlayerSpectating(i0);
        }}
    }
    if(
GetAliveCount() == && ServerData[Started] == true)
    {
        
TextDrawSetString(Waiting3"MAP NAME: ~r~~h~LOADING..");
        
TextDrawSetString(Waiting4"MAP AUTHOR: ~r~~h~LOADING..");
        if(
progressMap == true) return 0;
        for(new 
0MAX_PLAYERSi++){
        if(
IsPlayerConnected(i)){
        if(
Spectekiler[i] == 1){ StopSpectate(i); }
        }}
        
KillTimer(UMapTimer);
        
ServerData[Started] = false;
        
progressMap false;
        
ProgressForMap();
    }
    return 
true;

this is to get alive players !
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)