Jump to content

[PAWN] Tutorial 12 - Haussystem (Spawnen, Betreten, Verlassen)


PresidenT AnaS
 Share

Recommended Posts

Hello This day we have work about :Haussystem (Spawnen, Betreten, Verlassen)

OLUTION: Copy&Paste

//Includes

#include <a_samp>
#include <ocmd>
#include <sscanf2>
#include <a_mysql>
 
 
//Farben
#define COLOR_RED 0xFF0000FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_BLUE 0x009BFFFF
#define COLOR_YELLOW 0xEBFF00FF
#define COLOR_CHAT 0xFEFEFEFF
#define COLOR_FADE1 0xE6E6E6FF
#define COLOR_FADE2 0xD1CFD1FF
#define COLOR_FADE3 0xBEC1BEFF
#define COLOR_FADE4 0x919397FF
 
//Dialoge
#define DIALOG_TELEPORT 1
#define DIALOG_REGISTER 2
#define DIALOG_LOGIN 3
#define DIALOG_AUTOHAUS 4
 
//MySQL
#define db_host "127.0.0.1"
#define db_user "samp"
#define db_pass "mysqlpasswort"
#define db_db "samp"
 
//Limits
#define CHAT_RADIUS 40
#define CHAT_FADES 5
 
 
//enums
enum playerInfo{
eingeloggt,
level,
db_id,
alevel,
fraktion,
rang,
spawnchange
}
 
enum hausEnum{
Float:h_x,
Float:h_y,
Float:h_z,
Float:ih_x,
Float:ih_y,
Float:ih_z,
h_interior,
h_besitzer[MAX_PLAYER_NAME],
h_preis,
h_id,
h_pickup,
Text3D:h_text
}
 
enum buildingsEnum{
Float:b_x,
Float:b_y,
Float:b_z,
Float:b_ix,
Float:b_iy,
Float:b_iz,
b_interior,
b_shopname[15]
}
 
enum carEnum{
id_x,
model,
besitzer,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
db_id
}
 
enum autohausEnum{
Float:s_x,
Float:s_y,
Float:s_z,
Float:s_r
}
 
enum autohauscarEnum{
model,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
c_preis,
ah_id,
id_x
}
 
enum fraktEnum{
f_name[128],
Float:f_x,
Float:f_y,
Float:f_z,
Float:f_r,
f_inter,
f_world,
f_color
}
 
//Globale Variablen
new dbhandle;
new sInfo[MAX_PLAYERS][playerInfo];
new fInfo[][fraktEnum] = {
{"Zivilist", 0.0, 0.0, 0.0, 0.0, 0, 0, COLOR_WHITE},
{"LSPD", 295.2865,-55.4151,2.7772,293.463, 0, 0, COLOR_BLUE},
{"Taxi", 0.0, 0.0, 0.0, 0.0, 0, 0, COLOR_YELLOW}
 
};
new bInfo[][buildingsEnum] = {
{243.0825,-178.3224,1.5822,285.3642,-41.5576,1001.5156,1,"AMMUN1"},//Ammunation1
{212.1142,-202.1886,1.5781,372.4523,-133.5244,1001.4922,5,"FDPIZA"}//Pizza
};
new cInfo[50][carEnum];
new ahInfo[][autohausEnum] = {
{125.7242,-170.1469,1.2838,177.7335},//id: 0 1. autohaus
{189.8910,-263.3446,1.2829,180.6895}//id: 1 2. autohaus
};
new ahCars[][autohauscarEnum] = {
{560,118.5637,-153.0834,1.2834,186.6475,50000,0},
{411,106.3420,-158.7720,1.7527,257.3197,80000,0},
{400,204.8894,-265.4756,1.2866,354.1406,10000,1}
};
new hInfo[100][hausEnum];
new sekunden_timer;
 
new autosOhneMotor[] = {509,510,481};
 
new Text:uhrzeitLabel;
 
 
//Forwards
forward OnUserCheck(playerid);
forward OnPasswordResponse(playerid);
forward carSavedToDB(carid);
forward OnPlayerCarsLoad(playerid);
forward OnHausesLoad();
forward sekunde();
forward unfreezePlayer(playerid);
 
main()
{
 
}
 
public OnGameModeInit()
{
SetGameModeText("MrMonat Tutorialmode");
AddPlayerClass(1,199.0846,-150.0331,1.5781,359.1443,WEAPON_MP5,500,0,0,0,0);
AddPlayerClass(2,199.0846,-150.0331,1.5781,359.1443,WEAPON_MP5,500,0,0,0,0);
AddPlayerClass(3,199.0846,-150.0331,1.5781,359.1443,WEAPON_MP5,500,0,0,0,0);
 
DisableInteriorEnterExits();
ManualVehicleEngineAndLights();
 
//MySQL
dbhandle = mysql_connect(db_host,db_user,db_db,db_pass);
 
//Gebäude laden
for(new i=0; i<sizeof(bInfo); i++)
{
CreatePickup(1239,1,bInfo[b_x],bInfo[b_y],bInfo[b_z]);
Create3DTextLabel("Zum Betreten /enter",COLOR_RED,bInfo[b_x],bInfo[b_y],bInfo[b_z],10,0,1);
}
 
//Autos erstellen
AddStaticVehicle(560,214.1196,-141.3710,1.3052,1.6804,-1,-1); //Sultan
 
//Autohäuser laden
for(new i=0; i<sizeof(ahCars); i++)
{
ahCars[id_x]=AddStaticVehicle(ahCars[model],ahCars[c_x],ahCars[c_y],ahCars[c_z],ahCars[c_r],-1,-1);
}
 
//Häuser laden
new query[128];
format(query, sizeof(query), "SELECT * FROM haus");
mysql_function_query(dbhandle, query, true, "OnHausesLoad", "");
 
//Timer
sekunden_timer = SetTimer("sekunde",1000,true);
 
//Textdraws
uhrzeitLabel = TextDrawCreate(557.000000, 12.000000, "00:00");
TextDrawBackgroundColor(uhrzeitLabel, 255);
TextDrawFont(uhrzeitLabel, 3);
TextDrawLetterSize(uhrzeitLabel, 0.580000, 2.399999);
TextDrawColor(uhrzeitLabel, -1);
TextDrawSetOutline(uhrzeitLabel, 1);
TextDrawSetProportional(uhrzeitLabel, 1);
 
return 1;
}

 

Thanks ƒor your time.Good Bye.

 

Edited by Cdorsu
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.