Jump to content

[PAWN] Tutorial 1


PresidenT AnaS
 Share

Recommended Posts

 
 
 
SA:MP / PAWN Tutorial #01 - Motor- & Lichtsystem
 
pawn is not as developed in terms of controlling files without a plugin// include help, I'll show how to rename a file without losing its contents.
A function that you write once and run anywhere in script whenever you want (in order for example) without writing the whole function, but calling the stock's through simple row. Usually stock sites are placed somewhere at the end of the script.
What I have described above only works on text files. You can not rename files of type:
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
 
//Globale Variablen
new dbhandle;
new sInfo[MAX_PLAYERS][playerInfo];
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 sekunden_timer;
//Farben
#define COLOR_RED 0xFF0000FF
//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"
//Forwards
forward OnUserCheck(playerid);
forward OnPasswordResponse(playerid);
forward carSavedToDB(carid);
forward OnPlayerCarsLoad(playerid);
forward sekunde();
forward unfreezePlayer(playerid);
main()
 

 

public OnPlayerDisconnect(playerid, reason)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[id_x]==0)continue;
if(cInfo[besitzer]!=sInfo[playerid][db_id])continue;
GetVehiclePos(cInfo[id_x],cInfo[c_x],cInfo[c_y],cInfo[c_z]);
GetVehicleZAngle(cInfo[id_x],cInfo[c_r]);
new query[256];
format(query,sizeof(query),"UPDATE autos SET x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",cInfo[c_x],cInfo[c_y],cInfo[c_z],cInfo[c_r],cInfo[db_id]);
mysql_function_query(dbhandle,query,false,"","");
DestroyVehicle(cInfo[id_x]);
cInfo[id_x]=0;
}
savePlayer(playerid);
resetPlayer(playerid);
return 1;
 

 

 
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[id_x]!=0)continue;
cInfo[besitzer]=sInfo[playerid][db_id];
cInfo[c_x]=x;
cInfo[c_y]=y;
cInfo[c_z]=z;
cInfo[c_r]=r;
cInfo[model]=modelid;
cInfo[id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
new string[128];
format(string,sizeof(string),"Das Auto cInfo[%i] wurde erstellt.",i);
SendClientMessageToAll(COLOR_RED,string);
saveCarToDB(playerid,i);
return 1;
}
 
 

 

 
//Spawn
SetPlayerPos(playerid,199.0846,-150.0331,1.5781);
}
if(listitem==1)
{
//Farm
SetPlayerPos(playerid,0.0,0.0,6.0);
 
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

U must to follow my rules for nice work

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.