SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/03/2020, 10:24 PM   #1
RudeWorld
Little Clucker
 
RudeWorld's Avatar
 
Join Date: Aug 2018
Posts: 19
Reputation: 0
Default Select a SPAWNPOINT

I Want to make the players select their spawnpoint after they died but I Can't send the player to that area. I made a dialog where it shows off the areas that player can spawn at that moment but I don't know how I could send them to that places.
Code:
CMD:testcmd(playerid, params[])
{
	new dialog[256], str[128];
	for (new i; i < sizeof CaptureZone; i++) {
  		if ((GetPlayerTeam(playerid) >= 0 && GetPlayerTeam(playerid) < sizeof TEAM) && TEAM[GetPlayerTeam(playerid)][E_TEAM_VALID] && GetPlayerTeam(playerid) == CaptureZone[i][E_CAPTURE_ZONE_OWNER]) {
   			format(str, sizeof(str), "%s\n", CaptureZone[i][E_CAPTURE_ZONE_NAME]);
    		strcat(dialog, str);
	    }
  		ShowPlayerDialog(playerid, DIALOG_SS_TEST, DIALOG_STYLE_LIST, "Select a SPAWNPOINT and click \"DONE\" to spawn", dialog, "DONE", "CLOSE");
 	}
	return true;
}

As you guys can see it shows off the areas that players squad controls at that moment but I don't know how I could send the player to that areas.
RudeWorld is offline   Reply With Quote
Old 29/03/2020, 10:31 PM   #2
v1k1nG
Huge Clucker
 
v1k1nG's Avatar
 
Join Date: Feb 2018
Posts: 493
Reputation: 35
Default Re: Select a SPAWNPOINT

You forgot to show us your dialog
__________________
My test server: 51.91.122.18:7778
My Discord contact: [SF]kAn3#9933
v1k1nG is offline   Reply With Quote
Old 29/03/2020, 10:33 PM   #3
RudeWorld
Little Clucker
 
RudeWorld's Avatar
 
Join Date: Aug 2018
Posts: 19
Reputation: 0
Default Re: Select a SPAWNPOINT

Quote:
Originally Posted by v1k1nG View Post
You forgot to show us your dialog
Sorry, but I don't have one yet.
RudeWorld is offline   Reply With Quote
Old 29/03/2020, 10:37 PM   #4
v1k1nG
Huge Clucker
 
v1k1nG's Avatar
 
Join Date: Feb 2018
Posts: 493
Reputation: 35
Default Re: Select a SPAWNPOINT

Well if you don't script up your dialog, the command will only show the dialog up, and whatever you do with it nothing will happen because you didn't manage how it'll work.
__________________
My test server: 51.91.122.18:7778
My Discord contact: [SF]kAn3#9933
v1k1nG is offline   Reply With Quote
Old 29/03/2020, 10:40 PM   #5
RudeWorld
Little Clucker
 
RudeWorld's Avatar
 
Join Date: Aug 2018
Posts: 19
Reputation: 0
Default Re: Select a SPAWNPOINT

Quote:
Originally Posted by v1k1nG View Post
Well if you don't script up your dialog, the command will only show the dialog up, and whatever you do with it nothing will happen because you didn't manage how it'll work.
I don't know how to script my dialog that is my problem. I don't know how I could send players to areas that they choose
RudeWorld is offline   Reply With Quote
Old 29/03/2020, 10:49 PM   #6
v1k1nG
Huge Clucker
 
v1k1nG's Avatar
 
Join Date: Feb 2018
Posts: 493
Reputation: 35
Default Re: Select a SPAWNPOINT

Ah so you need someone to script it for you, you need to post this under scripting request, this is scripting help section. Anyways you should provide more informations as well, who will help you will need the coordinates of the spawn points, I suppose they're saved into CaptureZone array? So you will need to post that array as well or it will be difficult.
__________________
My test server: 51.91.122.18:7778
My Discord contact: [SF]kAn3#9933
v1k1nG is offline   Reply With Quote
Old 29/03/2020, 10:55 PM   #7
RudeWorld
Little Clucker
 
RudeWorld's Avatar
 
Join Date: Aug 2018
Posts: 19
Reputation: 0
Default Re: Select a SPAWNPOINT

Quote:
Originally Posted by v1k1nG View Post
Ah so you need someone to script it for you, you need to post this under scripting request, this is scripting help section. Anyways you should provide more informations as well, who will help you will need the coordinates of the spawn points, I suppose they're saved into CaptureZone array? So you will need to post that array as well or it will be difficult.
Code:
new CaptureZone[][E_CAPTURE_ZONE] =
{
    {"TEST Base", {-616.215, 2319.064, -883.128, 2448.955}, {-788.9371, 2427.7222, 157.1758}, 0},
    {"Fort Carson", {236.278, 1215.514, -436.320, 971.573}, {-276.5989, 1098.4270, 19.5938}, 1},
    {"El Quebrados", {-1656.527, 2713.138, -1306.527, 2503.138}, {-1488.5271, 2601.1384, 55.6875}, 1},
    {"Al Basrah", {-65.625, 2606.521, -377.112, 2769.553}, {-257.1729,2701.2317,62.5351}, 2},
    {"Las Barrancas", {-647.640, 1386.259, -927.863, 1624.122}, {-747.4941, 1563.1694, 26.9609}, 2}
};
I think this is what you are talking about.
RudeWorld is offline   Reply With Quote
Old 29/03/2020, 11:03 PM   #8
v1k1nG
Huge Clucker
 
v1k1nG's Avatar
 
Join Date: Feb 2018
Posts: 493
Reputation: 35
Default Re: Select a SPAWNPOINT

yes it is, you need to post the E_CAPTURE_ZONE enum as well though.
__________________
My test server: 51.91.122.18:7778
My Discord contact: [SF]kAn3#9933
v1k1nG is offline   Reply With Quote
Old 29/03/2020, 11:08 PM   #9
RudeWorld
Little Clucker
 
RudeWorld's Avatar
 
Join Date: Aug 2018
Posts: 19
Reputation: 0
Default Re: Select a SPAWNPOINT

Quote:
Originally Posted by v1k1nG View Post
yes it is, you need to post the E_CAPTURE_ZONE enum as well though.
Code:
enum E_CAPTURE_ZONE
{
    E_CAPTURE_ZONE_NAME[64],
    Float:E_CAPTURE_ZONE_GANGZONE_OFFSET[4],
    Float:E_CAPTURE_ZONE_CP_OFFSET[3], 		
    E_CAPTURE_ZONE_OWNER,
    E_CAPTURE_ZONE_ATTACKER,
    E_CAPTURE_ZONE_COUNTDOWN,
    E_CAPTURE_ZONE_GANGZONE,
    E_CAPTURE_ZONE_CP,
    E_CAPTURE_ZONE_AREA,
    E_CAPTURE_ZONE_TIMER,
    E_CAPTURE_ZONE_PLAYERS_IN_ZONE
};
RudeWorld is offline   Reply With Quote
Old 29/03/2020, 11:45 PM   #10
xRadical3
Huge Clucker
 
xRadical3's Avatar
 
Join Date: May 2017
Location: Iran
Posts: 458
Reputation: 17
Default Re: Select a SPAWNPOINT

pawn Code:
//OnPlayerConnect()
SpawnPoint[playerid] = -1; //reset variable

//OnDialogRespnse()
if(response)
{
    for (new i; i < sizeof CaptureZone; i++) {
        if ((GetPlayerTeam(playerid) >= 0 && GetPlayerTeam(playerid) < sizeof TEAM) && TEAM[GetPlayerTeam(playerid)][E_TEAM_VALID] && GetPlayerTeam(playerid) == CaptureZone[i][E_CAPTURE_ZONE_OWNER]) {
            if(!strcmp(CaptureZone[i][E_CAPTURE_ZONE_NAME], inputtext, true))
            {
                SpawnPoint[playerid] = i;
                break;
            }
        }
}

//OnPlayerSpawn
new id = SpawnPoint[playerid];
if(id != -1)
{
    if(GetPlayerTeam(playerid) == CaptureZone[id][E_CAPTURE_ZONE_OWNER])
    {
        SetPlayerPos(playerid, CaptureZone[id][E_CAPTURE_ZONE_CP_OFFSET][0], CaptureZone[id][E_CAPTURE_ZONE_CP_OFFSET][1],CaptureZone[id][E_CAPTURE_ZONE_CP_OFFSET][2]);
    } else
    {
        SpawnPoint[playerid] = -1; //if her team lose the area
    }
}
xRadical3 is offline   Reply With Quote
Reply

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
Shoot Spawnpoint s0ZNIz Scripting Help 23 02/12/2014 04:16 PM
[Map] [MAP] Awsume Spawnpoint <3 xD miley1 Maps 0 18/05/2012 02:50 AM
How can i make npc that stand at the spawnpoint Ben147 Help Archive 8 21/04/2010 03:30 PM
NPC just stands on spawnpoint. HydraX Help Archive 6 12/01/2010 08:19 PM
How to set spawnpoint when joining Rickzor14 Help Archive 1 13/12/2009 01:54 PM


All times are GMT. The time now is 06:19 PM.


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