16.01.2019, 11:37
Hi! When i login,i give the spawn button,i want to skip it,how?
My GM:
My GM:
Код:
//==============================Include-uri==============================// #include <a_samp> #include <a_mysql> #include <zcmd> //==============================Define-uri==============================// #define mysql_host "localhost" #define mysql_db "pear_data" #define mysql_user "root" #define mysql_pass "" #define COLOR_RED 0xFF0000FF //==============================Enum==============================// enum { DIALOG_LOGIN, DIALOG_REGISTER, DIALOG_NOTHING }; enum pInfo { pParola, pID, pAdmin, pCash }; //==============================New==============================// new PlayerInfo[MAX_PLAYERS][pInfo]; new handle; //==============================Forward-uri==============================// forward MySQLConnect(); forward OnPlayerLogin(playerid); forward OnLogin(playerid); //==============================MAIN==================================// main() { print("Server-ul s-a incarcat!"); } //==============================Public-uri==============================// public MySQLConnect() { handle = mysql_connect(mysql_host, mysql_user, mysql_db, mysql_pass); if(mysql_errno() != 0) { printf("Conexiunea la baza de date %s a esuat ---> Server Inchis ~~~", mysql_db); SendRconCommand("exit"); } else { printf("Conexiunea la baza de date '%s' cu user-ul '%s' a reusit!!!", mysql_db, mysql_user); } return 1; } public OnGameModeInit() { MySQLConnect(); SetGameModeText("RealLife 0.01"); return 1; } public OnGameModeExit() { mysql_close(handle); return 1; } public OnPlayerConnect(playerid) { TogglePlayerSpectating(playerid, true); new query[100]; mysql_format(handle, query, sizeof(query), "SELECT * FROM conturi WHERE Nume = '%s'", GetName(playerid)); mysql_tquery(handle, query, "OnPlayerLogin", "i", playerid); return 1; } public OnPlayerLogin(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logheaza-te!", "{D0F307}Te rog sa-ti introduci parola contului mai jos!", "Logare", "Iesire"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Inregistrare", "{D0F307}Trebuie sa iti creezi un cont ca sa joci pe server. \n{D0F307}Tasteaza mai jos o parola, pentru a te inregistra!", "Gata", "Iesire"); } return 1; } public OnLogin(playerid) { new rows, fields,temporar[200]; cache_get_data(rows, fields); if(rows) { PlayerInfo[playerid][pParola] = cache_get_field_content(0, "Parola",temporar); PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID"); PlayerInfo[playerid][pAdmin] = cache_get_field_content_int(0, "Admin"); PlayerInfo[playerid][pCash] = cache_get_field_content_int(0, "Bani"); SpawnPlayer(playerid); TogglePlayerSpectating(playerid, false); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "{D0F307}Te rog sa introduci parola corecta, pentru a te loga pe server.", "Logare", "Iesire"); } return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { SetPlayerPos(playerid, 1479.6548, -1725.2207, 13.5469); SetPlayerInterior(playerid,0); SetPlayerVirtualWorld(playerid, 0); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new query[128], ip[25]; switch(dialogid) { case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "{D0F307}Introdu o parola pentru a te inregistra pe server!", "Gata", "Iesire"); GetPlayerIp(playerid, ip, sizeof(ip)); mysql_format(handle, query, sizeof(query), "INSERT INTO conturi (Nume, Parola, IP) VALUES ('%s', '%e', '%s')", GetName(playerid), inputtext, ip); mysql_query(handle, query); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Logheaza-te!", "{D0F307}Te rog sa-ti introduci parola contului mai jos!", "Logare", "Iesire"); } return 1; } case DIALOG_LOGIN: { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "{D0F307}Te rog sa iti introduci parola corecta, pentru a te loga pe server.", "Logare", "Iesire"); mysql_format(handle, query, sizeof(query), "SELECT * FROM conturi WHERE Parola = '%e' LIMIT 0,1", inputtext); mysql_tquery(handle, query, "OnLogin", "i", playerid); } return 1; } } return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } //==============================Stock-uri==============================// stock GetName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; } FormatNumber(number) { new Str[15]; format(Str, 15, "%d", number); if (strlen(Str) < sizeof(Str)) { if (number >= 1000 && number < 10000) strins( Str, ",", 1, sizeof(Str)); else if (number >= 10000 && number < 100000) strins(Str, ",", 2, sizeof(Str)); else if (number >= 100000 && number < 1000000) strins(Str, ",", 3, sizeof(Str)); else if (number >= 1000000 && number < 10000000) strins(Str, ",", 1, sizeof(Str)),strins(Str, ",", 5, sizeof(Str)); else if (number >= 10000000 && number < 100000000) strins(Str, ",", 2, sizeof(Str)),strins(Str, ",", 6, sizeof(Str)); else if (number >= 100000000 && number < 1000000000) strins(Str, ",", 3, sizeof(Str)),strins(Str, ",", 7, sizeof(Str)); else if (number >= 1000000000 && number < 10000000000) strins(Str, ",", 1, sizeof(Str)), strins(Str, ",", 5, sizeof(Str)), strins(Str, ",", 9, sizeof(Str)); else format(Str, 10, "%d", number); } else format( Str, 15, "<BUG>" ); return Str; } //==============================Comenzi Jucatori==============================// CMD:stats(playerid, params[]) { new string1[180],string2[180],string3[180],stringy[920]; format(string1, sizeof(string1), "\n{2B95FF}Nume: {FFFFFF}%s [%d]",GetName(playerid), playerid); format(string2, sizeof(string2), "{2B95FF}Bani: {FFFFFF}%s", FormatNumber(GetPlayerMoney(playerid))); format(string3, sizeof(string3), "\n{2B95FF}Admin: {FFFFFF}%d", PlayerInfo[playerid][pAdmin]); format(stringy, sizeof(stringy), "%s\n%s\n%s", string1, string2, string3); ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Buletin", stringy,"Bine",""); return 1; } CMD:buletin(playerid, params[]) { return cmd_stats(playerid, params); } //==============================Comenzi STAFF==============================// CMD:mypos(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "EROARE: {FFFFFF}Nu esti autorizat sa folosesti aceasta comanda."); new Float:x,Float:y,Float:z,Float:angle; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); new string1[180],string2[180],string3[180],string4[180],string5[180],string6[180],string7[180],stringy[920]; format(string1, sizeof(string1), "\n{2B95FF}X: {FFFFFF}%0.1f [%d]", z); format(string2, sizeof(string2), "{2B95FF}Y: {FFFFFF}%0.1f", y); format(string3, sizeof(string3), "{2B95FF}Z: {FFFFFF}%0.1f", z); format(string4, sizeof(string4), "{2B95FF}Rotatie: {FFFFFF}%0.1f", angle); format(string5, sizeof(string5), "{2B95FF}Skin: {FFFFFF}%d", GetPlayerSkin(playerid)); format(string6, sizeof(string6), "{2B95FF}Virtual world(VW): {FFFFFF}%d", GetPlayerVirtualWorld(playerid)); format(string7, sizeof(string7), "{2B95FF}Arma(ID): {FFFFFF}%d", GetPlayerWeapon(playerid)); format(stringy, sizeof(stringy), "%s\n%s\n%s\n%s\n%s\n%s\n%s", string1, string2, string3, string4, string5, string6, string7); ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Pozitia ta", stringy,"Bine",""); return 1; }