Sounds getting on my nerves and gates
#1

Well i made it so when i go into an area a sound plays.... well instead of it stopping while out of the area it keeps going... here is my script(if anyone can help please do):

pawn Код:
public IsPlayerInClub()
{
    new Float:X, Float:Y, Float:Z; //We use this to store player position
    for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the playerid is "i"
    {
        GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
        if (X <= 1291.7345 && X >= 1264.4211 && Y <= 1336.7477 && Y >= 1311.3464 && playerinclub[i] == 0)
        {
            PlayerPlaySound(i, 1062, 0, 0, 0);
            playerinclub[i] = 1;
        }
        else
        {
            PlayerPlaySound(i, 0, 0, 0, 0);
            playerinclub[i] = 0;
        }
    }
    return 1;
}
pawn Код:
forward IsPlayerInclub
i also have a timer setup on ongamemodeinit.


the sound just never stops!

also my gates not working :S
pawn Код:
public ClubGate()
{
    new Float:x,Float:y,Float:z;
    GetObjectPos(980,x,y,z);
    MoveObject(980,x,y,z,5);
}
the tiemr for that is called when the command is spoken

pawn Код:
if(strcmp(cmdtext,"/CSHClub",true)==0)
    {
        if(strcmp("CSMajor", playersnames) || strcmp("[MF]Shark_killer", playersnames))
        {
            new Float:x,Float:y,Float:z;// i so d
            GetObjectPos(980,x,y,z);
            SetTimer("ClubGate",3000,false);
            MoveObject(980,x+100,y,z, 5);
        }
        else
        {
            SendClientMessage(playerid,0xFFF0000FF,"Your name isnt CSMajor or [MF]Shark_killer!");
        }
        return 1;
    }
Reply
#2

PlayerPlaySound(i, 1062, 0, 0, 0);
If its a song use this
PlayerPlaySound(i, 1063, 0, 0, 0);
to stop it


To move gate

pawn Код:
new Gate,GateOpen;

Gate=CreateObject(blabla) (this should be on OnGameModeInit)

    if(strcmp(cmdtext,"/CSHClub",true)==0)
    {
        if(strcmp("CSMajor", playersnames) || strcmp("[MF]Shark_killer", playersnames))
        {
            if (GateOpen==0) { MoveObject(Gate,OPENPOSx,OPENPOSy,OPENPOSz, 5);GateOpen=1 }
            else { MoveObject(Gate,CLOSEDPOSx,CLOSEDPOSy,CLOSEDPOSz, 5);GateOpen=0 }
        }
        else SendClientMessage(playerid,0xFFF0000FF,"Your name isnt CSMajor or [MF]Shark_killer!");        
        return 1;
    }
Reply
#3

Quote:
Originally Posted by [DRD]Rodney
Посмотреть сообщение
PlayerPlaySound(i, 1062, 0, 0, 0);
If its a song use this
PlayerPlaySound(i, 1063, 0, 0, 0);
to stop it


To move gate

pawn Код:
new Gate,GateOpen;

Gate=CreateObject(blabla) (this should be on OnGameModeInit)

    if(strcmp(cmdtext,"/CSHClub",true)==0)
    {
        if(strcmp("CSMajor", playersnames) || strcmp("[MF]Shark_killer", playersnames))
        {
            if (GateOpen==0) { MoveObject(Gate,OPENPOSx,OPENPOSy,OPENPOSz, 5);GateOpen=1 }
            else { MoveObject(Gate,CLOSEDPOSx,CLOSEDPOSy,CLOSEDPOSz, 5);GateOpen=0 }
        }
        else SendClientMessage(playerid,0xFFF0000FF,"Your name isnt CSMajor or [MF]Shark_killer!");        
        return 1;
    }
better convention please?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)