Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-04-08, 16:51


arkopi







Wiek: 31
Na forum: 5579 dni
Posty: 177

Piwa: 60

Respekt: 50

Ostrzeżeń: 20%
Witam mam problem odnosnie restarta serwera kt?ry moze zostac wlaczony przez kazdego gracza wpisujac %s jako swoje haslo w rejestracji

a oto kod rejestracji

Kod:

#include <a_samp>
#include <dini>
#include <dudb>
#include <colors>
#pragma tabsize 0 // nie chce mi sie xD
#define CZERWONY 0xFF0000AA
#define ZIELONY 0x00CC00AA
#define C_ZOLTY "{FFFF00}"
#define C_BIALY "{FFFFFF}"
#define C_CZERWONY "{FF0000}"
new SpawnPoRazPierwszy[MAX_PLAYERS];
new Zalogowany[MAX_PLAYERS];
new smierc[MAX_PLAYERS];
new zabujstwa[MAX_PLAYERS];
new odwiedzin[MAX_PLAYERS];
new wiadomosci[MAX_PLAYERS];
new Float:Xpp[MAX_PLAYERS];
new Float:Ypp[MAX_PLAYERS];
new Float:Zpp[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SpawnPoRazPierwszy[playerid] = 1;
if(dini_Exists(FileStats(playerid)))
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Panel logowania", "Ten nick jest ju? zarejestrowany. Wpisz "C_ZOLTY"has?o"C_CZERWONY" i zaloguj si?.", "Zaloguj", "Anuluj");
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Panel rejestracji", "Aby gra? na serwerze zarejestruj si?! Wpisz "C_ZOLTY"has?o.", "Zarejestruj", "Anuluj");
}
return 1;
}
public OnPlayerDeath(playerid,killerid, reason)
{
smierc[playerid]++;
zabujstwa[killerid]++;
SpawnPoRazPierwszy[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(SpawnPoRazPierwszy[playerid] == 1)
{

}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(Zalogowany[playerid] == 1)
{
SaveStats(playerid);
}
return 1;
}
FileStats(playerid)
{
new p[256];
format(p, sizeof(p), "%s.ini", udb_encode(Player(playerid)));
return p;
}
SaveStats(playerid)
{
dini_IntSet(FileStats(playerid), "score", GetPlayerScore(playerid));//punkty
dini_IntSet(FileStats(playerid), "money", GetPlayerMoney(playerid));//kasa
dini_IntSet(FileStats(playerid), "smierci", smierc[playerid]);//ilo?? ?mierci
dini_IntSet(FileStats(playerid), "zab?jstwa", zabujstwa[playerid]);//ilo?? zab?jstw
dini_IntSet(FileStats(playerid), "odwiedzin", odwiedzin[playerid]);//odwiedzin
dini_IntSet(FileStats(playerid), "Wiadomosci na chacie", wiadomosci[playerid]);//wiadomosci na chacie
GetPlayerPos(playerid, Xpp[playerid],Ypp[playerid],Zpp[playerid]);
}
//==============================================================================
LoadStats(playerid)
{
SetPlayerScore(playerid,dini_Int(FileStats(playerid), "score"));
GivePlayerMoney(playerid,dini_Int(FileStats(playerid), "money"));
smierc[playerid] = dini_Int(FileStats(playerid), "smierci");
zabujstwa[playerid] = dini_Int(FileStats(playerid), "zab?jstwa");
wiadomosci[playerid] = dini_Int(FileStats(playerid), "Wiadomosci na chacie");
odwiedzin[playerid] = dini_Int(FileStats(playerid), "odwiedzin");
}
public OnPlayerText(playerid, text[])
{
wiadomosci[playerid]++;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 11)
{
if(response == 0)
{
SendClientMessage(playerid, 0xff0000ff, "Anulowales");
}
else
{
Xpp[playerid] = dini_Float(FileStats(playerid), "X");
Ypp[playerid] = dini_Float(FileStats(playerid), "Y");
Zpp[playerid] = dini_Float(FileStats(playerid), "Z");
SetPlayerPos(playerid, Xpp[playerid], Ypp[playerid], Zpp[playerid]);
}
if(Xpp[playerid] == 0.0)
{

}

return 1;
}
new string[128];
if(dialogid == 1)
{
if(response == 0)
{
SendClientMessage(playerid, CZERWONY, "Nie zalogowano = kick");
Kick(playerid);
}
else
{
if(strlen(inputtext) > 0)
{
new stringg[256];
format(stringg, sizeof(stringg), "%s", dini_Get(FileStats(playerid), "HASLO"));
if(!strcmp(inputtext, stringg))
{
SendClientMessage(playerid, ZIELONY, "> Zalogowano <");
LoadStats(playerid);
Zalogowany[playerid]=1;
odwiedzin[playerid]++;
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Panel logowania","Nieprawid?owe has?o! Spr?buj ponownie.","Zaloguj","Anuluj");
}
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Panel logowania","Nieprawidlowe haslo! Sprobuj ponownie.","Zaloguj","Anuluj");
}
}
return 1;
}
if(dialogid == 2)
{
if(response == 0)
{
SendClientMessage(playerid, CZERWONY, "Nie wolno gra? bez rejestracji!");
Kick(playerid);
}
else
{
SendClientMessage(playerid,ZIELONY,"Zarejestrowano");
format(string,sizeof(string),"Twoje has?o: %s",inputtext);
SendClientMessage(playerid,ZIELONY,string);
SendClientMessage(playerid,ZIELONY,"ZALOGOWANO!");
odwiedzin[playerid]++;
Zalogowany[playerid]=1;
if (!dini_Exists(FileStats(playerid)))
{
dini_Create(FileStats(playerid));
SaveStats(playerid);
dini_Set(FileStats(playerid),"HASLO",inputtext);
}
}
return 1;
}
return 0;
}
Player(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
return player;
}


nie wiem czy to wina rejestracji czy cos jest nie tak z mapa za pomoc daje :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-04-08, 18:01


__.A.__







Wiek: 30
Na forum: 5170 dni
Posty: 151

Piwa: 855

Respekt: 110
Respekt: 110

Kod:

#include <a_samp>
#include <dini>
#include <dudb>
#include <colors>
#pragma tabsize 0 // nie chce mi sie
#define CZERWONY 0xFF0000AA
#define ZIELONY 0x00CC00AA
#define C_ZOLTY "{FFFF00}"
#define C_BIALY "{FFFFFF}"
#define C_CZERWONY "{FF0000}"
#define A_CHAR(%0) for(new i = strlen(%0) - 1; i >= 0; i--)\
if(%0[i] == '%')\
%0[i] = '#'
new SpawnPoRazPierwszy[MAX_PLAYERS];
new Zalogowany[MAX_PLAYERS];
new smierc[MAX_PLAYERS];
new zabujstwa[MAX_PLAYERS];
new odwiedzin[MAX_PLAYERS];
new wiadomosci[MAX_PLAYERS];
new Float:Xpp[MAX_PLAYERS];
new Float:Ypp[MAX_PLAYERS];
new Float:Zpp[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SpawnPoRazPierwszy[playerid] = 1;
if(dini_Exists(FileStats(playerid)))
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Panel logowania", "Ten nick jest ju? zarejestrowany. Wpisz "C_ZOLTY"has?o"C_CZERWONY" i zaloguj si?.", "Zaloguj", "Anuluj");
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Panel rejestracji", "Aby gra? na serwerze zarejestruj si?! Wpisz "C_ZOLTY"has?o.", "Zarejestruj", "Anuluj");
}
return 1;
}
public OnPlayerDeath(playerid,killerid, reason)
{
smierc[playerid]++;
zabujstwa[killerid]++;
SpawnPoRazPierwszy[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(SpawnPoRazPierwszy[playerid] == 1)
{

}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(Zalogowany[playerid] == 1)
{
SaveStats(playerid);
}
return 1;
}
FileStats(playerid)
{
new p[256];
format(p, sizeof(p), "%s.ini", udb_encode(Player(playerid)));
return p;
}
SaveStats(playerid)
{
dini_IntSet(FileStats(playerid), "score", GetPlayerScore(playerid));//punkty
dini_IntSet(FileStats(playerid), "money", GetPlayerMoney(playerid));//kasa
dini_IntSet(FileStats(playerid), "smierci", smierc[playerid]);//ilo?? ?mierci
dini_IntSet(FileStats(playerid), "zab?jstwa", zabujstwa[playerid]);//ilo?? zab?jstw
dini_IntSet(FileStats(playerid), "odwiedzin", odwiedzin[playerid]);//odwiedzin
dini_IntSet(FileStats(playerid), "Wiadomosci na chacie", wiadomosci[playerid]);//wiadomosci na chacie
GetPlayerPos(playerid, Xpp[playerid],Ypp[playerid],Zpp[playerid]);
}
//==============================================================================
LoadStats(playerid)
{
SetPlayerScore(playerid,dini_Int(FileStats(playerid), "score"));
GivePlayerMoney(playerid,dini_Int(FileStats(playerid), "money"));
smierc[playerid] = dini_Int(FileStats(playerid), "smierci");
zabujstwa[playerid] = dini_Int(FileStats(playerid), "zab?jstwa");
wiadomosci[playerid] = dini_Int(FileStats(playerid), "Wiadomosci na chacie");
odwiedzin[playerid] = dini_Int(FileStats(playerid), "odwiedzin");
}
public OnPlayerText(playerid, text[])
{
wiadomosci[playerid]++;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

A_CHAR(inputtext);

if(dialogid == 11)
{
if(response == 0)
{
SendClientMessage(playerid, 0xff0000ff, "Anulowales");
}
else
{
Xpp[playerid] = dini_Float(FileStats(playerid), "X");
Ypp[playerid] = dini_Float(FileStats(playerid), "Y");
Zpp[playerid] = dini_Float(FileStats(playerid), "Z");
SetPlayerPos(playerid, Xpp[playerid], Ypp[playerid], Zpp[playerid]);
}
if(Xpp[playerid] == 0.0)
{

}

return 1;
}
new string[128];
if(dialogid == 1)
{
if(response == 0)
{
SendClientMessage(playerid, CZERWONY, "Nie zalogowano = kick");
Kick(playerid);
}
else
{
if(strlen(inputtext) > 0)
{
new stringg[256];
format(stringg, sizeof(stringg), "%s", dini_Get(FileStats(playerid), "HASLO"));
if(!strcmp(inputtext, stringg))
{
SendClientMessage(playerid, ZIELONY, "> Zalogowano <");
LoadStats(playerid);
Zalogowany[playerid]=1;
odwiedzin[playerid]++;
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Panel logowania","Nieprawid?owe has?o! Spr?buj ponownie.","Zaloguj","Anuluj");
}
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Panel logowania","Nieprawidlowe haslo! Sprobuj ponownie.","Zaloguj","Anuluj");
}
}
return 1;
}
if(dialogid == 2)
{
if(response == 0)
{
SendClientMessage(playerid, CZERWONY, "Nie wolno gra? bez rejestracji!");
Kick(playerid);
}
else
{
SendClientMessage(playerid,ZIELONY,"Zarejestrowano");
format(string,sizeof(string),"Twoje has?o: %s",inputtext);
SendClientMessage(playerid,ZIELONY,string);
SendClientMessage(playerid,ZIELONY,"ZALOGOWANO!");
odwiedzin[playerid]++;
Zalogowany[playerid]=1;
if (!dini_Exists(FileStats(playerid)))
{
dini_Create(FileStats(playerid));
SaveStats(playerid);
dini_Set(FileStats(playerid),"HASLO",inputtext);
}
}
return 1;
}
return 0;
}
Player(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
return player;
}


Prosze.

Podpis
new map test beta:

ip serwera: 80.72.36.203:4056
Postaw piwo autorowi tego posta
 

 
Tagi: restart :: serwera
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] Restart serwera Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku