05.09.2010, 16:51
(
Последний раз редактировалось willsuckformoney; 13.11.2010 в 04:07.
)
Introduction:
|* --------------------- *|
Anything in the red text means its new.
|* --------------------- *|
Its a really small include actually, I been working on it for a while because my mind just can't stick to one thing no matter how simple it is. I made this include because of a post I seen on my forum surf.
Functions/Callbacks:
Add this under #include <a_samp>
pawn Код:
#include <City>
Quote:
* CityCreate(cityname[], Float:minx, Float:miny, Float:maxx, Float:maxy) cityname[] = "NAME" Create-A-City * CityCreateForPlayer(cityname[], playerid, Float:minx, Float:miny, Float:maxx, Float:maxy) cityname[] = "NAME" Create-A-City * IsObjectInCity(objectid, cityid) * IsPlayerInCity(playerid, cityid); * DestroyCity(cityid); * GetPlayerCity(playerid); * * Callbacks * * OnPlayerEnterCity(playerid,cityid) * OnPlayerExitCity(playerid,cityid) * Those are needed in the script in order to compile. |
Use of Functions/Callbacks:
Well first for CreateCity you have this
Код:
CityCreate(cityname[], Float:minx, Float:miny, Float:maxx, Float:maxy) CityCreateForPlayer(cityname[], playerid, Float:minx, Float:miny, Float:maxx, Float:maxy)
Код:
CityCreate("LasVenturas", 805.7734, 525.5044, 2919.469, 2942.825); CityCreateForPlayer("LasVenturas", playerid,805.7734, 525.5044, 2919.469, 2942.825); // This will create it for ONLY the player (If it is under OnPlayerSpawn OnPlayerConnect etc
Next is IsPlayerInCity(playerid, cityid);
You would just use this in any callback you have basically to see if the player is in a certain city like
pawn Код:
if(IsPlayerInCity(playerid,LV) == true)
{
GivePlayerCash(playerid,20000);
}
This is the basic Destruction of the city mostly used OnFilterScriptExit or OnGameModeInIt
And last function is GetPlayerCity(playerid);
This actually just another IsPlayerInCity but this is used to get the players current city (tested and it works for command)
Now for the CallBacks
First is OnPlayerEnterCity(playerid,cityid) I'll just show you what i had.
pawn Код:
public OnPlayerEnterCity(playerid,cityid)
{
if(cityid == LV)
{
SendClientMessage(playerid,0x67F6F6AA,"You have entered the city Las Venturas!");
}
return 1;
}
pawn Код:
public OnPlayerExitCity(playerid,cityid)
{
if(cityid == LV)
{
SendClientMessage(playerid,0x67F6F6AA,"You have left Las Venturas");
}
return 1;
}
pawn Код:
public OnFilterscriptInIt()
{
if(IsObjectInCity(testO, LV))
{
print("testO object is in Las Venturas");
}
return 1;
}
Downloads:
Cities.INC file - Pastebin
Cities Example FS - Pastebin
http://www.mediafire.com/?e2r9i2s0ns...ST FS AMX File - Media Fire
http://www.mediafire.com/?65kylyzca2...st FS PWN File - Media Fire
http://www.mediafire.com/?lg8r7hu808w7gz9]City.INC - Media Fire
Credits:
Las Venturas CNR for the CreateCityForPlayer idea.
Bugs
I can't find any bugs mostly because I don't have a test partner. If you find any please post here.
NOTE: CreateCityForPlayer was tested with me and me only.
Hope this help some of you.
Код:
/* * @version : v3 * @author : willsuckformoney (FrosTiC) * @date : September 4, 2010 * @update : November 1, 2010 * * The basics and the Funcions/Uses. * * What can use? * CityCreateForPlayer(cityname[], playerid, Float:minx, Float:miny, Float:maxx, Float:maxy) cityname[] = "NAME" Create-A-City * CityCreate(cityname[], Float:minx, Float:miny, Float:maxx, Float:maxy) cityname[] = "NAME" Create-A-City * IsPlayerInCity(playerid, cityid); * DestroyCity(cityid); * GetPlayerCity(playerid); * |* REMOVED *| * * Callbacks * * OnPlayerEnterCity(playerid,cityid) * OnPlayerExitCity(playerid,cityid) * Those are needed in the script in order to compile. */