Commands.
#1

Can anyone tell me how to make commands E.g /enter or /exit ( You may think i am a noob but... )

- Luis
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true) == 0)
{
SetPlayerPos(playerid, x, y, z);
return 1;
}

if (strcmp("/exit", cmdtext, true) == 0)
{
SetPlayerPos(playerid, x, y, z);
return 1;
}

return 0;
}
Reply
#3

I seem to get this error?

Код:
C:\Users\BooNii3\San andreas SAMP Servers\The Godfather RP\gamemodes\gf.pwn(8187) : error 017: undefined symbol "x"
C:\Users\BooNii3\San andreas SAMP Servers\The Godfather RP\gamemodes\gf.pwn(26262) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Well you need to change the coordinates to the ones you want lol. Have a read. https://sampwiki.blast.hk/wiki/SetPlayerPos
Reply
#5


did u make some Positions?
if not:

1) Goto Gta sa/mp
2) Go to a place where you want to teleported if you typ /enter or /exit
3) On that place Typ /save pos
4) Go out the server
5) Go to youre San Andreas map C:\Program Files\Rockstar Games\GTA San Andreas
6) Search in that map for savedpositions
7) Take the position
More on https://sampwiki.blast.hk/wiki/SetPlayerPos


luckie12
Reply
#6

Quote:
Originally Posted by Luis_Geramia
I seem to get this error?

Код:
C:\Users\BooNii3\San andreas SAMP Servers\The Godfather RP\gamemodes\gf.pwn(8187) : error 017: undefined symbol "x"
C:\Users\BooNii3\San andreas SAMP Servers\The Godfather RP\gamemodes\gf.pwn(26262) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
X, Y, and Z are the coordinates of your destination, or location of where you want to be. Change that to where ever you
want the player who typed /enter and /exit to be in.
What the above posters said, https://sampwiki.blast.hk/wiki/SetPlayerPos visit that
Reply
#7

1. Get co-ordinates to the entrance of the building. So I would go infront of the building I want them to be able to enter, then type "/save BuildingCoords", or whatever name you wish.

2. I would create a pickup, like an "i", to show that you can enter that building. (Pickup Reference: https://sampwiki.blast.hk/wiki/AddStaticPickup)

Код:
public OnGameModeInIt()
AddStaticPickup(1239, 1, x, y, z, -1);
The first number is the pickup ID, (****** search Samp Pickup ID's), second is the type (1 = can't be picked up, always exists), the x and y and z are the coordinates of the entrance that we got. The -1 is the virtual world, (-1 = Shows in all virtual worlds)

Then, you will need to create a new command under on player command text, "/enter". Below is how it should look, if I didn't make a mistake.
Код:
public OnPlayerCommandText (playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, (How many feet away you can be from the entrance), x, y, z))
		{
		SetPlayerPos(playerid, x, y, z);
		return 1;
		}
		else
		{
		SendClientMessage(playerid, COLOR_(Whatever Color), "You are not at the entrance to any building!");
		}
	}
	return 0;
}
Reply
#8

pawn Код:
SetPlayerInterior( playerid, ID);
Replace ID witht he interior id.
Reply
#9

Quote:
Originally Posted by luigifan9
pawn Код:
SetPlayerInterior( playerid, ID);
Replace ID witht he interior id.
As, for the interiors
https://sampwiki.blast.hk/wiki/SetPlayerInterior
and the id's
https://sampwiki.blast.hk/wiki/InteriorIDs
Reply
#10

Is there a way to make the pickup say "Hospital" or something like that, when you stand on it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)