CreateCity - Make Your Own Cities v3 -
willsuckformoney - 05.09.2010
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>
Only 4 functions and 2 callbacks
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)
So lets say you wanna create LV so you would do this
Код:
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
That would create a rectangle around LV
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);
}
Now onto DestroyCity(cityid);
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;
}
And with OnPlayerExitCity(playerid,cityid) its kinda the same way....
pawn Код:
public OnPlayerExitCity(playerid,cityid)
{
if(cityid == LV)
{
SendClientMessage(playerid,0x67F6F6AA,"You have left Las Venturas");
}
return 1;
}
IsObjectInCity(objectid, cityid);
pawn Код:
public OnFilterscriptInIt()
{
if(IsObjectInCity(testO, LV))
{
print("testO object is in Las Venturas");
}
return 1;
}
The callbacks are set on a timer so it will detect every half second? if the player has entered or exited the city, and no it don't spam the chat with it, it only sends once until re enter or exit.
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.
*/
Re: CreateCity - Make Your Own Cities -
sekol - 05.09.2010
It might be usefull

Good job
Re: CreateCity - Make Your Own Cities -
xJester - 05.09.2010
Nice! Useful for RP (:
Re: CreateCity - Make Your Own Cities -
willsuckformoney - 05.09.2010
Thanks ||
Re: CreateCity - Make Your Own Cities -
[XST]O_x - 05.09.2010
Very nice mate,a lot of people looked for something like this :d
Re: CreateCity - Make Your Own Cities -
willsuckformoney - 05.09.2010
That's main reason I did this
Re: CreateCity - Make Your Own Cities - [L3th4l] - 05.09.2010
This would come in handy making the Loading screens when changing cities in VC and LC
Re: CreateCity - Make Your Own Cities -
Kitten - 05.09.2010
Very nice +10
Re: CreateCity - Make Your Own Cities -
willsuckformoney - 05.09.2010

thanks kitten and [L3th4l]

I never really though of that
Re: CreateCity - Make Your Own Cities -
willsuckformoney - 05.09.2010
Any suggestions? Anything i should add?