Director.
#1

Hi all.I need help with my director and workers system.I want to do that,when director write /spectateworker,director can spectate workers,and with arrows < > can change worker,and first worker,be that who first connected for ex:

Code:
1 connected = player1
2 connected = player2
3 connected = player3
4 connected = player4
ok i write /spectateworker,and i start spectate player1,then when i use arrow > i go spectate player2,then when i press < i will again spectate player1,the problem is i don't know how to do that with keys.
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

I know keys,but i need script,when i press key....
Reply
#4

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#5

OMG,you don't understand....

Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_RIGHT)
{
//What i have write here?
}
return 1;
}
Reply
#6

Quote:
Originally Posted by budelis
View Post
OMG,you don't understand....

Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_RIGHT)
{
//What i have write here?
}
return 1;
}
I'll show you mine,

PHP Code:
if(newkeys KEY_FIRE)
    {
        if(
HaveTaser[playerid] == 1)
        {
            new 
victimid GetClosestPlayer(playerid);
            if(
IsPlayerConnected(victimid))
             {
                if(
GetDistanceBetweenPlayers(playerid,victimid) < 2)
                {
                    if(
tazed[victimid] == 0)
                    {
                    
tazed[playerid] = 1;
                    new 
Float:health;
                    
GetPlayerHealth(victimidhealth);
                    
SetPlayerHealth(victimidhealth 2.0);
                    
TogglePlayerControllable(victimid,0);
                    
ApplyAnimationEx(victimid"CRACK""crckdeth2"4.010000);
                    
format(stringsizeof(string), "* You were Tazed by %s for 20 seconds."GetName(playerid));
                    
SendClientMessage(victimidCOLOR_WHITEstring);
                    
format(stringsizeof(string), "* You Tazed %s for 20 seconds."GetName(victimid));
                    
SendClientMessage(playeridCOLOR_WHITEstring);
                    
SetTimerEx("tazerclear",20000,false,"d",victimid);
                    return 
1;
                    }
                 }
             }
         }
    } 
I Don't know what's in your script to help you with it.
Reply
#7

Quote:

the problem is i don't know how to do that with keys.

Don't blame me.

What is your worker and director variable?
Reply
#8

PlayerData[playerid][specialybe]//worker

PlayerData[playerid][plead]//director
Reply
#9

Simple code:
pawn Code:
new Spectate[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_RIGHT)
    {
        for(new i=Spectate[playerid];i<MAX_PLAYERS;i++)
        {
            if(IsPlayerConnected(i)
            {
                if(PlayerData[i][specialybe] != 0)
                {
                    PlayerSpectatePlayer(playerid,i);
                    Spectate[playerid] = i;
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#10

Ok thanks you.And now how to do with KEY_LEFT ? when i press < i will start spectate previously player.
Reply
#11

pawn Code:
new Spectate[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_LEFT)
    {
        for(new i=Spectate[playerid];i=>0;i--)
        {
            if(IsPlayerConnected(i)
            {
                if(PlayerData[i][specialybe] != 0)
                {
                    PlayerSpectatePlayer(playerid,i);
                    Spectate[playerid] = i;
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#12

Thanks you very much.But if in my server is 1 worker i start spec him,and if i press > or <does i spectate him again,i have mean does every time when i press > or < repeat fuction
Code:
PlayerSpectatePlayer(playerid,i);
?
Reply
#13

If there's only 1 worker, you can only spectate him.
Reply
#14

Maybe you can do zcmd+sccanf2 command /dpzu,when i write this i start spectate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)