Argonath RPG - A World of its own

Argonath RPG Community => Hardware/Software support => Resolved issues => Topic started by: Fatboy_Rob on November 22, 2007, 12:11:51 am

Title: Need Scripting help
Post by: Fatboy_Rob on November 22, 2007, 12:11:51 am
Ok, What i wanna do, is make my character spawn INSIDE an interior. Dave said this will not work, but i disagree, cause ive seen it in one of the Crapppy Game modes that comes with SAMP Server thingy.

Here is co-ordinates
Code: [Select]
AddPlayerClass(188,2247.9373,-1163.9312,1029.7969,5.2074,0,0,0,0,0,0); // JeffoINT1The interior is ID 15

ive looked on SAMP forums, and even posted, and i didnt get any help, just smartass comments.

Here are the charcter spawns that i have, that all work
Code: [Select]
public OnGameModeInit()
{
SetGameModeText(" Haydens Fire");
    AddPlayerClass(170,2231.8018,-1177.7627,29.8044,38.2942,0,0,0,0,0,0); // JeffoETERIOR
    AddPlayerClass(180,2231.8018,-1177.7627,29.8044,38.2942,0,0,0,0,0,0); // JeffoETERIOR
    AddPlayerClass(233,2231.8018,-1177.7627,29.8044,38.2942,0,0,0,0,0,0); // JeffoETERIOR
    AddPlayerClass(68,2231.8018,-1177.7627,29.8044,38.2942,0,0,0,0,0,0); // JeffoETERIOR
AddStaticVehicle(576,2228.2075,-1162.9020,25.4755,88.9719,-1,-1); // LS - Jeffo1
AddStaticVehicle(566,2216.9023,-1166.3242,25.4342,88.5275,-1,-1); // LS - Jeffo2
AddStaticVehicle(412,2205.3872,-1157.1360,25.5754,90.6576,27,1); // Jeffo3
    AddStaticVehicle(412,2218.0481,-1170.3824,25.5646,269.0656,27,1); // Jeffo4
return 1;
}

Now, someone said, under the OnPlayerSpawn, to set
SetPlayInterior in that bracket

Code: [Select]
public OnPlayerSpawn(playerid)
{
return 1;
}
my question, how do i get it to spawn inside.

:ps: the {code} thing, messes up the scripts, so, dont worry, there not like that

-Hayden
Title: Re: Need Scripting help
Post by: Dogmatic on November 22, 2007, 12:39:53 am
do this in OnGameModeInt:

Code: [Select]
AddPlayerClass(188,2247.9373,-1163.9312,1029.7969,5.2074,0,0,0,0,0,0); // JeffoINT1

and OnPlayerSpawn
Code: [Select]
public OnPlayerSpawn(playerid)
{
  SetPlayerInterior(playerid, 15);
  SetPlayerPos(playerid,2247.9373,-1163.9312,1029.7969);
return 1;
}
~ the spawn interior is set the moment the player spawns, as well as the coordinates, they match up to spawn in the hotel

and!:

(http://i233.photobucket.com/albums/ee139/Douja-101/sa-mp-003.png) <<< outcome
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 22, 2007, 01:05:37 am
Hey, Thanks alot dogmatic, i guess, none told me about

SetPlayerPos(playerid,2247.9373,-1163.9312,1029.7969);

:S

Well, thanks again
Title: Re: Need Scripting help
Post by: John_Vaughan on November 22, 2007, 03:04:07 am
How you all do to get the Coordinates to use them as Spawn, Spawn cars, etc?
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 22, 2007, 10:22:37 am
Hello Ryder,

Go into your Root GTA SA Folder, and look for somthing called SAMP Debug
SA:MP Debug Guide READ THIS BEFORE USING! (http://wiki.sa-mp.com/wiki/Debug_Guide)

it explains it all in there.

Also, This is a Great help for beginner scripters (http://wiki.sa-mp.com/index.php/Main_Page)
Title: Re: Need Scripting help
Post by: Andre9977 on November 22, 2007, 05:30:41 pm
Use /save next time...

To spawn vehicles, change skins & so on, use [FS] Debug Mode by [CP]Simon
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 22, 2007, 08:00:30 pm
Ok, Wellm my major problem that im having, is my Charcater/class select screen, ive asked on SAMP Forums, and even on IRC thing, and none helped me with my problem.


Well ok, i used got the co-ordinates using /save, i did it twice, Once for the Player position, Once for the camera position.
now, i used to the 1st camera position cordinates for the setplayercamerlookat

now, they said on SAMP forums, not to use the Angle(A) Axis, so....
idk, when i set it, the camera is way high in the air overlooking east LS(about 200 feet high)
Here is the script that im using, thats screwed.
Code: [Select]
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2026.4141,-1203.0288,21.3570);
SetPlayerCameraPos(playerid, 2029.0081,-1201.9775,21.6540);
SetPlayerCameraLookAt(playerid, 2029.0081,-1201.9775,21.6540);
return 1;
}

Here are the coordinates im using(found with /save)

Player Position:
Code: [Select]
AddPlayerClass(188,2026.4141,-1203.0288,21.3570,290.3901,0,0,0,0,0,0); // PLAYERPOS
Camera Posistion:
Code: [Select]
AddPlayerClass(188,2029.0081,-1201.9775,21.6540,110.0768,0,0,0,0,0,0); // CAMERAPOS
So, wtf is going on? any idea?
Title: Re: Need Scripting help
Post by: Dave on November 22, 2007, 09:23:46 pm
The cam pos, is the same line as the line for the player spawn, it won't work. Search in the SA:MP forums for something relating to Setcamerapos or somthing simmilar



Dave
Title: Re: Need Scripting help
Post by: Gandalf on November 22, 2007, 09:31:30 pm
SetPlayerPos (player id, x coordinate, y coordinate, z coordinate) sets the player position
SetPlayerCamera((player id, x coordinate, y coordinate, z coordinate) sets the camera position
SetPlayerCameraLookat(player id, x coordinate, y coordinate, z coordinate) sets the point the camera looks to


In your case, you have the camera position equal to the look at, the camera looks at itself. Change the coordinates to the player coordinates and the result will be better.

Title: Re: Need Scripting help
Post by: Dave on November 22, 2007, 10:49:02 pm
W00t!! i was close with the camera pos :D :D
Title: Re: Need Scripting help
Post by: Dogmatic on November 23, 2007, 03:28:19 am
Code: [Select]
SetPlayerPos(playerid, 2026.4141, -1203.0288, 21.3570);
SetPlayerCameraPos(playerid, 2029.0081, -1201.9775, 21.6540);
SetPlayerCameraLookAt(playerid, 2026.4141, -1203.0288, 21.3570);
~ SetPlayerCameraLookAt should have the same coordinates as SetPlayerPos

(http://i233.photobucket.com/albums/ee139/Douja-101/sa-mp-001.png) <<< maybe with different skin

Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 23, 2007, 09:06:09 pm
Also, can we sticky this topic(possibly, and title it "Need Scripting help? ask here")

ok, i got a question, since i have no idea how to make teams.

Code: [Select]
AddPlayerClass(167,2231.8018,-1177.7627,29.8044,38.2942,0,0,0,0,0,0); // JeffoINT2
ok, you have the cordinates, can you use other cordinates for different spawn points instead of making different teams?
Title: Re: Need Scripting help
Post by: Dave on November 23, 2007, 09:56:29 pm
Why not just make a board for scripting help, or (i hope this isn't advertising) visit www.av-clan.com/f0rum  and check the Scripting section there.....  :D
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 23, 2007, 10:15:45 pm
Yea, that would be, really awsome, cause Argonath Scripters can help us(i.e Andre, Dave, etc etc, and sometimes Gandalf)
Title: Re: Need Scripting help
Post by: Andre9977 on November 23, 2007, 10:17:55 pm
Teams, umm...

1.
Code: [Select]
static gTeam[MAX_PLAYERS];
Code: [Select]
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x33AA33AA
Code: [Select]
#define TEAM_HOBO 0
#define TEAM_PIZZA 1
#define TEAM_TRUCKER 2
#define TEAM_CIVILIAN 3

2.
Code: [Select]
public SetPlayerTeamFromClass(playerid,classid)
{
if (classid >= 0 && classid <= 1)
{
gTeam[playerid] = TEAM_HOBO;
  }
else if (classid >= 2 && classid <= 2)
{
gTeam[playerid] = TEAM_PIZZA;
}
else if (classid >= 3 && classid <= 3)
{
gTeam[playerid] = TEAM_TRUCKER;
}
else if (classid >= 4 && classid <= 7)
{
gTeam[playerid] = TEAM_CIVILIAN;
}
return 1;
}

3.
Code: [Select]
public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == TEAM_HOBO)
{
SetPlayerColor(playerid,COLOR_GREEN);
  }
else if(gTeam[playerid] == TEAM_PIZZA)
{
SetPlayerColor(playerid,COLOR_RED);
}
else if(gTeam[playerid] == TEAM_TRUCKER)
{
SetPlayerColor(playerid,COLOR_ORANGE);
}
else if(gTeam[playerid] == TEAM_CIVILIAN)
{
SetPlayerColor(playerid,COLOR_WHITE);
}
}

1. Top of Your script - You need them only once
2. This is the basic - Used so the "GM" could reconize the players status from his class. All classes start from 0, not 1.
So, if You got The first AddPlayerClass - It is 0, Second AddPlayerClass is 1, so on...
3.  Here we bring the colors I gave to You in start - Just look at the examples & You will get the point :)

Read wiki.sa-mp.com, also
- Andre
Title: Re: Need Scripting help
Post by: Tice on November 23, 2007, 10:18:37 pm
Andre gave a better description, last post on page 1.

Without defining different teams, anyone (even at the same spawnpoint) can kill eachother and get points (I'm guessing it's a DM gamemode?), so you need to define the teams, like this:

Under #include <a_samp>

Code: [Select]
#define TEAM_teamname 0
#define TEAM_teamname 1
#define TEAM_teamname 2

teamname, for example: TEAM_RED or TEAM_BLUE

When you define teams, you can do all kinds of cool things, like "if(gTeam[playerid] == TEAM_teamname)", "SetPlayerTeamFromClass, SetPlayerToTeamColor, anti teamkilling, etc.
Title: Re: Need Scripting help
Post by: Andre9977 on November 23, 2007, 10:22:16 pm
Yeah, I was just lucky to roll on the post first, but for example mine helps, Yours helps to get the basics, exactly.

I've also fixed few things, what I had flying in my head...
If You feel like needing help, ask :)

// The "SetCameraPosition"'s, I think Kapil once showed his skills at sa-mp.com forums & Found a good way to get the coordinates.
You might try with /csel (Camera Select), while using [FS] Debug Mode by Simon
Title: Re: Need Scripting help
Post by: Dave on November 23, 2007, 10:30:16 pm
http://argonathscriptingsupport.smfforfree4.com

is that allowed?? or is it against the rules?  :neutral: , i thought it would come in pretty handy for some people here. If it is allowed, could all knowlegeable scripters please contact me in forums by PM.....


Dave
Title: What the F*** Happened!?
Post by: Fatboy_Rob on November 24, 2007, 11:07:44 am
ok, Well, im scripting all day, and im in my server to test stuff, and i go out for about 4 hours, i get back, and i cant acess my server through the internet...
i cant even see it on my favorites list, all it says is Retriving info.....

i can play it on LAN, but, idk, this is pissing me off, realllly bad...

any suggestions?
Title: Re: Need Scripting help
Post by: Andre9977 on November 24, 2007, 11:57:01 am
Probably Your internet cut off while You wasn't looking.

1) Try remaking the internet settings You had before this happent
2) Close server console & re run it in case You haven't yet. May be caused if You haven't shut it after there was a connection lost
Title: Re: Need Scripting help
Post by: [GSF]Niall on November 24, 2007, 12:27:51 pm
http://argonathscriptingsupport.smfforfree4.com

is that allowed?? or is it against the rules?  :neutral: , i thought it would come in pretty handy for some people here. If it is allowed, could all knowlegeable scripters please contact me in forums by PM.....


Dave

nice idea ;) im starting to learn how to script it might come in handy.
Title: Re: What the F*** Happened!?
Post by: Tice on November 24, 2007, 01:04:29 pm
ok, Well, im scripting all day, and im in my server to test stuff, and i go out for about 4 hours, i get back, and i cant acess my server through the internet...
i cant even see it on my favorites list, all it says is Retriving info.....

i can play it on LAN, but, idk, this is pissing me off, realllly bad...

any suggestions?

Try adding 127.0.0.1 in your favorites, or adding 'announce 1' in server.cfg
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 24, 2007, 09:09:03 pm
Yes, that work's, cause its my LAN, but, even if i have it on 127.0.0.1 with announce 1 on, will others be able to connect?
Posted on: November 24, 2007, 09:07:15 PM
Yes, that work's, cause its my LAN, but, even if i have it on 127.0.0.1 with announce 1 on, will others be able to connect?
Title: Re: Need Scripting help
Post by: Tice on November 24, 2007, 11:41:24 pm
Yes, that work's, cause its my LAN, but, even if i have it on 127.0.0.1 with announce 1 on, will others be able to connect?

Yes, but they will have to connect through your external IP.
Title: Re: Need Scripting help
Post by: Fatboy_Rob on November 25, 2007, 03:09:26 am
that dosent work(i guess)

Anyways. the problem was, that when my internet shut down for a quick second, it change my IP from XXX.XXX.XXX.100 to XXX.XXX.XXX.103

So, all i did was close the old port, and reopen the new one

So, thanks you guys

Oh Also, Andre, idk if you will hate me for this, but i modified your weapon FS, i added guns & cool stuff(i still give you full credits though)
Title: Re: Need Scripting help
Post by: Andre9977 on November 25, 2007, 09:26:39 am
I hate You

Good job :)
Title: Re: Need Scripting help
Post by: Watti on November 25, 2007, 12:08:57 pm
ok mine doesnt connect :)... Help :P ive forwarded ports...
SimplePortal 2.3.7 © 2008-2025, SimplePortal