SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/01/2011, 07:06 AM   #1
Haydz
Gangsta
 
Haydz's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 752
Reputation: 44
Default Quick question.

How could i go about setting another players pos based on which cage the player got put in.

example - Player1 gets put in cage1, so player2 would also get put in cage1, if player happened to spawn in cage3, player2 would also spawn in cage3 etc etc.
Thanks in advance.

i tryed this.
pawn Code:
new Float:DuelSpawn[][4] =
{
    {-1988.9508, 396.3534, 38.6947, 93.1988}, //cage 1 - if the player randomly gets spawned in here, it will put the other player to spawn in this cage also.
    {-1962.7333, 394.0844, 38.6947, 92.2355}, //cage 2 - same as above
    {-1962.9875, 378.6306, 38.6947, 88.5222}, //cage 3 -same as above
    {-1988.8269, 370.3514, 38.6947, 96.6222} //cage 4 - same as above
};
//This is what i tryed but knew it wouldn't work out.
            new rand = random(sizeof(DuelSpawn));
            if(rand == 1) cage1[playerid] = 1; //if the player gets put in cage 1, the other player will spawn in cage 1
                        if(rand == 2) cage2[playerid] = 1; - as above
                        if(rand == 3) cage3[playerid] = 1; - as above
                        if(rand == 4) cage4[playerid] = 1; - as above
            SetPlayerPos(playerid, DuelSpawn[rand][0], DuelSpawn[rand][1],DuelSpawn[rand][2]);
            SetPlayerFacingAngle(playerid, DuelSpawn[rand][3]);
           
            if(cage1[playerid] == 1) SetPlayerPos(giveplayerid, -1980.2439,396.1422,38.6947); //will put the other player in cage1 if the first player got spawned in cage 1
            if(cage2[playerid] == 1) SetPlayerPos(giveplayerid, -1953.0988,394.8125,38.6947);
            if(cage3[playerid] == 1) SetPlayerPos(giveplayerid, -1953.3700,378.1370,38.6947);
            if(cage4[playerid] == 1) SetPlayerPos(giveplayerid, -1979.6733,371.4133,38.6947);
Haydz is offline  
Old 06/01/2011, 07:09 AM   #2
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Quick question.

pawn Code:
new Float:DuelSpawn[][4] =
{
    {-1988.9508, 396.3534, 38.6947, 93.1988}, //cage 1 - if the player randomly gets spawned in here, it will put the other player to spawn in this cage also.
    {-1962.7333, 394.0844, 38.6947, 92.2355}, //cage 2 - same as above
    {-1962.9875, 378.6306, 38.6947, 88.5222}, //cage 3 -same as above
    {-1988.8269, 370.3514, 38.6947, 96.6222} //cage 4 - same as above
};

    new rand=random(sizeof(DuelSpawn));
    SetPlayerPos(playerid,DuelSpawn[rand][0],DuelSpawn[rand][1],DuelSpawn[rand][2]);
    SetPlayerPos(giveplayerid,DuelSpawn[rand][0],DuelSpawn[rand][1],DuelSpawn[rand][2]);
    SetPlayerFacingAngle(playerid,DuelSpawn[rand][3]);
    SetPlayerFacingAngle(giveplayerid,DuelSpawn[rand][3]);
Joe Staff is offline  
Old 06/01/2011, 07:13 AM   #3
Haydz
Gangsta
 
Haydz's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 752
Reputation: 44
Default Re: Quick question.

You sure?, looks like that would randomly put players inside 2 cages and they wouldn't get the same cage most the time.
Haydz is offline  
Old 06/01/2011, 07:18 AM   #4
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Quick question.

I'm sure, rand is choosing what cage, it's only random once, so every time after it's been set it will be the same number
Joe Staff is offline  
Old 06/01/2011, 07:18 AM   #5
Haydz
Gangsta
 
Haydz's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 752
Reputation: 44
Default Re: Quick question.

Alright cheers man, Thanks for the explaining it.
Haydz is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
quick question crazydc Help Archive 1 29/12/2009 11:24 PM
Quick Question _ASUS_ Help Archive 1 04/08/2009 11:36 PM
quick question StrickenKid Help Archive 1 23/02/2009 01:44 AM


All times are GMT. The time now is 02:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.