SA-MP Forums Archive
New Question.. - 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: New Question.. (/showthread.php?tid=391708)



New Question.. - WhiteDevil - 11.11.2012

Is there a way to set spawn points of players using:

public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid, 0, 299, 2495.3494, -1687.0780, 13.5152, 358.8612, 26, 36, 28, 150, 46, 1 );
return 1;
}

But make it specific per player.

I.e. john doe setspawninfo = (playerid, 0, 299, 2495.3494, -1687.0780, 13.5152, 358.8612, 26, 36, 28, 150, 46, 1 );
While jane does setspawninfo = (playerid, 0, 281, 2486.3142, -1647.9170, 14.0703, 182.1866, 26, 36, 28, 150, 46, 1 );

Any help is greatly appreciated!


Re: New Question.. - Vince - 11.11.2012

What do you think the playerid parameter is for?


Re: New Question.. - Abhishek. - 11.11.2012

ah you can even add this in this way:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(He is john doe codes...)
{
SetPlayerPos(playerid, 281, 2486.3142, -1647.9170, 14.0703);
//and give him the weapons you like
}
}



Re: New Question.. - WhiteDevil - 11.11.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
What do you think the playerid parameter is for?
Edit: That came out retarded
I tried putting the playerid in that parameter but it comes up saying:

' error 017: undefined symbol "johndoe" '

Quote:
Originally Posted by fatninja
Посмотреть сообщение
ah you can even add this in this way:
pawn Code:
public OnPlayerSpawn(playerid)
{
if(He is john doe codes...)
{
SetPlayerPos(playerid, 281, 2486.3142, -1647.9170, 14.0703);
//and give him the weapons you like
}
}
What is the ''(he is john doe codes...)''

Then could I apply that code to 'OnPlayerRequestClass'?


Re: New Question.. - Konstantinos - 11.11.2012

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    new
        name[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, name, MAX_PLAYER_NAME );
    if( !strcmp( name, "john_doe", true ) ) SetSpawnInfo( playerid, 0, 299, 2495.3494, -1687.0780, 13.5152, 358.8612, 26, 36, 28, 150, 46, 1 );
    else if( !strcmp( name, "jane_does", true ) ) SetSpawnInfo( playerid, 0, 281, 2486.3142, -1647.9170, 14.0703, 182.1866, 26, 36, 28, 150, 46, 1 );
    else SetSpawnInfo( playerid, 0, 299, x, y, z, angle, 26, 36, 28, 150, 46, 1 ); // Change the coordinates
    return 1;
}



Re: New Question.. - WhiteDevil - 11.11.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    new
        name[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, name, MAX_PLAYER_NAME );
    if( !strcmp( name, "john_doe", true ) ) SetSpawnInfo( playerid, 0, 299, 2495.3494, -1687.0780, 13.5152, 358.8612, 26, 36, 28, 150, 46, 1 );
    else if( !strcmp( name, "jane_does", true ) ) SetSpawnInfo( playerid, 0, 281, 2486.3142, -1647.9170, 14.0703, 182.1866, 26, 36, 28, 150, 46, 1 );
    else SetSpawnInfo( playerid, 0, 299, x, y, z, angle, 26, 36, 28, 150, 46, 1 ); // Change the coordinates
    return 1;
}
Dwayne you are a Gent and a Scholar good Sir!


Re: New Question.. - Abhishek. - 11.11.2012

i do think so it can be applied but i tink it could be in onPlayerConnect by setting the spawn info then Spawning him.
and your second problem thing of John_Codes
you only need it for a single player John_Codes,i dont think so
he is john Joe codes could be a thing like he is a admin level 5 so
if(PlayerInfo[pAdmin][playeid]==5)
or something you need and if you want it for all players then make a global varibal like
new SpawnChanger=1;
and in where you are using the spawn player codes
do
if(SpawnChange==1)
{
//your codes......
}
and when you want to stop the spawn changer set the SpawnChange to 0 by
SpawnChange=0;
you can do it from ingame with the help of commands
EDITorry i took a long time to write and the above post came so please dont mind if my post was use less


Re: New Question.. - WhiteDevil - 11.11.2012

Also, do i just copy the 'else if' line and change parameters for any new players I want to set specific spawn points for?


Re: New Question.. - Konstantinos - 11.11.2012

Quote:
Originally Posted by WhiteDevil
Посмотреть сообщение
Also, do i just copy the 'else if' line and change parameters for any new players I want to set specific spawn points for?
Yes, if you want to add more names, you can add as many as lines with else if you want. Just don't overdo it!


Re: New Question.. - WhiteDevil - 11.11.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Yes, if you want to add more names, you can add as many as lines with else if you want. Just don't overdo it!
I doubt i'll have that many people on my server, but just in case! Again, thanks for the help!