SA-MP Forums Archive
Spec bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spec bug (/showthread.php?tid=587639)



Spec bug - houssam501 - 01.09.2015

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;




Re: Spec bug - Evocator - 01.09.2015

TogglePlayerSpectating MUST be used first.

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

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


Re: Spec bug - houssam501 - 01.09.2015

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


Re: Spec bug - ChristolisTV - 01.09.2015

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




Re: Spec bug - houssam501 - 01.09.2015

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


Re: Spec bug - houssam501 - 02.09.2015

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


Re: Spec bug - Nixtren - 02.09.2015

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.


Re: Spec bug - houssam501 - 02.09.2015

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;




Re: Spec bug - houssam501 - 03.09.2015

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 !