SA-MP Forums

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

Thread Tools Display Modes
Old 22/05/2019, 01:43 AM   #1
Big Clucker
KevTheJoker's Avatar
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Default Adding and Removing Mapped Objects to/from your Script

Dual Gaming - Tutorial #1


I've noticed that some tutorials are hard for persons who are opening pawno for the first time or those who are a bit or completely new to how scripting on SA-MP works. This is my first tutorial, and I hope it helps and aids those who are adding objects to their server or gamemode for the first time.

Mapping your objects

Mapping in SA-MP is quite easy, in my point of view. It simply needs patience, dedication and time. Some persons tend to become annoyed when they're mapping, and when things aren't going their way, they flip off. Trust me, it happens to me sometimes. You may map an object in a map editor, but after adding it to the gamemode or filterscript and testing it on the server, it doesn't give the output you expected. What I want you to do is take a deep breath, and aim towards fixing it, as if you've never had difficulties while mapping it.

I personally recommend two map editor softwares. They are:
The SA-MP Map Editor is a software which is based on the default map of San Andreas. It covers the entire map, and it's used for adding, deleting, and editing objects of all kinds, sorts and models. It's easy to use, and after mapping a specific part of the map, you can click on "Show Code" to give you the codes of the Objects Created and Objects Deleted. On the other hand, the MTA map editor is mainly used for mapping MTA servers (no intentions in drawing your attention away from SA-MP and its Map Editor) but we're luckily able to convert the MTA Object Codes to SA-MP objects. Are you wondering where and how to do that? Simple, head over to After visiting this website, open your MTA map file (the file with the .map extension, e.g. which you saved via the MTA Map editor and copy its code. Paste the copied code into the dialog box on the convertffs website, and choose an OutPut mode. It's highly recommend to use CreateDynamicObjectEx when compiling object codes, because it caters for lags and avoids the objects limit. In some cases, you may find or see persons using CreateDynamicObject in their codes, but you'll get to know more about that (in-depth info) in the future.

  • CreateDynamicObjectEx - allows you to change the draw distance (how many objects a player can see from their distance) and show the object for various worlds, interiors or players.
  • CreateDynamicObject - has no settings to allow players to view objects from a far distance (streaming many at one time) and such objects can only be seen in one world or interior.
  • CreateObject - is default. However, it only limits you to a certain amount of objects (which can be seen here:
  • RemoveBuildingForPlayer - this removes the buildings and objects for players.

Differentiation and Specific Usages

If you're adding the mapped object codes to your .pwn gamemode file, found in the gamemode folder, place the codes under:
PHP Code:
public OnGameModeInit()
// Place the Codes here
return 1;

For adding the object codes to a filterscript's .pwn file, which can be found in the filterscripts folder, place them under:
PHP Code:
public OnFilterScriptInit()
// Place the Codes here
return 1;

For removing objects from the San Andreas Map, place the codes under:
PHP Code:
public OnPlayerRequestClass(playeridclassid)
// Codes
return 1;


PHP Code:
public OnPlayerConnect(playerid)
// Codes
return 1;

For some persons, the objects may not be removed if you place them under public OnPlayerConnect(playerid), so public OnPlayerRequestClass(playerid, classid) is an alternative method.

Tip: You must add the streamer include to your pawno/includes folder (which can be found here: GitHub Releases).

How to add it to your .pwn gamemode file after placing it in the include folder? Look below (add it below #include <a_samp>[At the top of the script])
PHP Code:
#include <streamer> 
Good luck, and if you have comments/remarks, feel free to share them below. I might make tutorials of how to create certain stuff, like faction-related scripts, attaching items/objects to players/vehicles, creating login/register dialogs, how to built master-account scripts (which allows you to create a main account, and create characters afterwards in-game (step-by-step), and some other stuff!
KevTheJoker is offline   Reply With Quote
Old 02/07/2019, 10:43 AM   #2
GTLS's Avatar
Join Date: Aug 2014
Location: India
Posts: 1,071
Reputation: 119
Default Re: Adding and Removing Mapped Objects to/from your Script

Decent tutorial, but you should also mention that only Dynamic Objects need streamer. Means, CreateObject function can be called without streamer. It is based on SAMP's default streamer. Also, Streamer requires plugin to be set up too. Its not your job to tell people that after you linked with Github but you mentioned how to add include in the GM, So I said you should mention about plugin too. Good job though.

I don't help for rep. I help cuz I was helped in the past.

Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote

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
Mapped Objects not showing up CrazyRussainHacker Scripting Help 5 30/05/2015 04:37 AM
Need help with mapped in objects JamesJohnson Server Support 21 23/11/2013 04:07 PM
[Map] Las Venturas Airport 0.3c objects mapped Paul.eboy Maps 4 13/11/2013 02:08 PM
Mapped Objects Not Solid? Donvalley Scripting Help 2 30/07/2013 12:53 PM
Mapped Objects don't appear unless you go very near to them Mr.Black Help Archive 2 16/06/2011 08:56 PM

All times are GMT. The time now is 11:26 PM.

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