[HELP]Spawning player with himself
#1

Hello all , I made something called /spawn , That will show the player a Dialog box , which include " LS / LV / SF "..
I made it so that player can choose his own Spawning city..

And i made some random spawns for all , that's done..

I want to know something that will make them spawn in the city they Choosed after their Death , like if he choosed LS , He must spawn in the random spawns of LS , and if he /q and comes , he must spawn at the City he choosed , Until he chooses any other City..
Thanks
Reply
#2

save a variable to their account, on spawn, switch the statement, for example:

pawn Код:
//Example:
public OnPlayerSpawn(playerid)
{
    switch(pdata[playerid][SpawnLocation])
    {
        case 1: //Los Santos
        {
       
        }
        case 2: //Las Venturas
        {
       
        }
        case 3: //San Fierro
        {
       
        }
    }
    return 1;
}
When the player selects their spawn location, save it to their data, everytime they spawn, the code will select that variable in the server's memory and spawn the player accordingly.
Reply
#3

#Edited So , what may i change in the Dialog Response? or the CMDpawns ....

Here goes the codes..

Код:
#include <a_samp>
#include <zcmd>
#define DIALOG_TELES 3

new Float:RandomSpawnLS[][] =
{
	{1091.0786,-1794.4513,13.6197,17.5902},
	{1959.8345,-2181.7620,13.5469,1.2967},
	{1186.0222,-1324.5660,13.5593,267.7775},
	{1316.6267,-910.7559,38.0429,178.3317},
	{1126.6519,-2036.7144,69.8838,271.3926},
	{2426.2029,-2457.7190,13.6201,316.5363}
};
new Float:RandomSpawnLV[][] =
{
	{1723.7269,1601.9326,10.0166,253.8372},
	{2025.2045,1545.3309,10.8203,273.8063},
	{2304.7341,2426.7422,10.8203,182.1671},
	{2519.7900,1824.4259,10.8129,92.7213},
	{2233.5547,1285.6110,10.8203,91.7813},
	{1061.9387,1807.1115,10.8203,1.3443}
};
new Float:RandomSpawnSF[][] =
{
	{-1983.3813,137.4470,27.6875,88.2716},
	{-2027.1277,-93.8835,35.1641,3.7260},
	{-2724.3335,-314.1563,7.1869,49.9080},
	{-2755.9751,375.4995,4.3350,273.4851},
	{-2489.6787,1200.6038,37.1529,215.2514},
	{-1508.9319,922.6257,7.1875,91.1702},
	{-1555.0504,-439.7008,6.0000,137.3754}

};



CMD:Tele(playerid,params[])
{
	ShowPlayerDialog(playerid,DIALOG_TELES,DIALOG_STYLE_LIST,"TELES","LS\nLV\nSF","Select","Close");
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_TELES)
	{
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0:
	                {
	                    new Random = random(sizeof(RandomSpawnLS));
						SetPlayerPos(playerid, RandomSpawnLS[Random][0], RandomSpawnLS[Random][1], RandomSpawnLS[Random][2]);
						SetPlayerFacingAngle(playerid, RandomSpawnLS[Random][3]);
	                }
				 case 1:
					{
	                    new Random = random(sizeof(RandomSpawnLV));
						SetPlayerPos(playerid, RandomSpawnLV[Random][0], RandomSpawnLV[Random][1], RandomSpawnLV[Random][2]);
						SetPlayerFacingAngle(playerid, RandomSpawnLV[Random][3]);
					}
				 case 2:
					{
	                    new Random = random(sizeof(RandomSpawnSF));
						SetPlayerPos(playerid, RandomSpawnSF[Random][0], RandomSpawnSF[Random][1], RandomSpawnSF[Random][2]);
						SetPlayerFacingAngle(playerid, RandomSpawnSF[Random][3]);
					}
	        }

	    }

	}
	return 1;
}
This is the Help needed codes
Reply
#4

The dialog response, you won't know what the player selects until they respond to the said dialog.
Reply
#5

Check the codes
Reply
#6

Bump ooo imma request help me
Reply
#7

Learn to script then... Jesus... Stop bumping your threads within 24 hours, and really, we're not here to simply copy and paste shit to you, you are able to find HELP here, not SLAVES...


Seriously, if you're just going to keep asking people to script shit for you, yet have the "I am a scripter" "PM Me" in your sig, you look like a serious fool.
Reply
#8

Dude I said up teach me , how to make something what I asked

#Edit - 1

See i make a enum

enum pTele_Player
{
pTele
};
new pInfo[MAX_PLAYERS][pTele_Player];


And in case what may i write?
Reply
#9

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
Dude I said up teach me , how to make something what I asked
There's Tutorials for a reason, and the Pawn Handbook for the rest...

What is there to teach? Copy-Pasta?
Reply
#10

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
There's Tutorials for a reason, and the Pawn Handbook for the rest...

What is there to teach? Copy-Pasta?
Copy-Pasta XD!

Yeah, about the my last comment, easy way to respawn play randomally at those locations:
if(PlayerInfo[playerid][pLV]) return SetPlayerPos(playerid, RandomSpawnLV);
Thats the correct way to do it under OnPlayerSpawn
I think what Banana_Ghost wrote is better so you wont use many variables. Just one.
Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
pawn Код:
//Example:
public OnPlayerSpawn(playerid)
{
    switch(pdata[playerid][SpawnLocation])
    {
        case 1: //Los Santos
        {
       
        }
        case 2: //Las Venturas
        {
       
        }
        case 3: //San Fierro
        {
       
        }
    }
    return 1;
}
Good day.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)