public OnPlayerDisconnect(playerid, reason)
{
if(pInfo[playerid][foglalt] == 1)
{
if(pInfo[playerid][felvesz] == 1 || pInfo[pInfo[playerid][hivofel]][felvesz] == 1)
{
new string[500];
if(pInfo[playerid][hivo] == playerid)
{
format(string,sizeof string,\"A Hivó letette a telefont.\");
SendClientMessage(pInfo[playerid][hivofel], COLOR_YELLOW, string);
format(string,sizeof string,\"letetted a telefont.\");
SendClientMessage(playerid, COLOR_YELLOW, string);
KillTimer(AktivHivasTimer[playerid]);
pInfo[playerid][foglalt] = 0; // nem foglalt nekem is
pInfo[pInfo[playerid][hivofel]][foglalt] =0; // nem meg neki is
pInfo[pInfo[playerid][hivofel]][felvesz] = 0; // hivofel felveszt nullázuk
pInfo[pInfo[playerid][hivofel]][hivofel] = -1;
pInfo[playerid][hivo] = -1;
pInfo[playerid][hivofel] = -1;
}else{ // másik fél nem hívó
format(string,sizeof string,\"Hívott letette a telefont \");
SendClientMessage(pInfo[playerid][hivo], COLOR_YELLOW, string);
format(string,sizeof string,\"letetted a telefont.\");
SendClientMessage(playerid, COLOR_YELLOW, string);
KillTimer(AktivHivasTimer[pInfo[playerid][hivofel]]);
pInfo[playerid][foglalt] = 0; // nem foglalt nekem is
pInfo[pInfo[playerid][hivofel]][foglalt] = 0; // nem meg neki is
pInfo[playerid][felvesz] = 0;
pInfo[pInfo[playerid][hivofel]][hivofel] = -1;
pInfo[pInfo[playerid][hivofel]][hivo] = -1;
}
}
}
if(pInfo[playerid][pWeaponkezbeid] !=0 || pfInfo[playerid][frakciobavan]==0 )// kezében van fegyver és nem vok szolgálatba
{
new weapons[13][2],query[100];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);
if(weapons[0] == pInfo[playerid][pWeaponkezbeid])
{
pInfo[playerid][pWeaponAmmo][pInfo[playerid][pWeaponkezbeslot]] = weapons[1];
break;
}
}
format(query, sizeof(query), \"UPDATE `fegyverek` SET slot%d=\'%d %d\' WHERE jatekosnev=\'%s\'\",pInfo[playerid][pWeaponkezbeslot],pInfo[playerid][pWeaponid][pInfo[playerid][pWeaponkezbeslot]],pInfo[playerid][pWeaponAmmo][pInfo[playerid][pWeaponkezbeslot]],jatekosnev(playerid));
mysql_query(query);
}
businessid[playerid] = 0;
busy[playerid] = 0;
pInfo[playerid][login] = 0;
pInfo[playerid][penztarca]=0;
pInfo[playerid][skin]=0;
pInfo[playerid][gangid]=0;
pInfo[playerid][admin]=0;
pInfo[playerid][teltulaj]=0;
pInfo[playerid][telszam]=0;
pInfo[playerid][telegyenleg]=0;
pInfo[playerid][hivofel] = -1;
pInfo[playerid][hivo] = -1;
pInfo[playerid][felvesz] = 0;
pInfo[playerid][foglalt] = 0;
pfInfo[playerid][frakcioid]= 0;
pfInfo[playerid][frakcioszint]=0;
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskin] = 0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt]=0;// ezzel volt igazából baj
pBInfo[playerid][bankszamlaszam]=0;
pBInfo[playerid][bankosszeg]=0;
pInfo[playerid][frakciojarmuben] = -3;
pInfo[playerid][pWeaponkezbeid]=0;
pInfo[playerid][pWeaponkezbeslot] = 0;
return 1;
}
CMD:kov(playerid,parmas[])
{
if(pfInfo[playerid][frakcioskinvalasztoba]==1)// itt a lényeg
{
if(pfInfo[playerid][frakcioid] == 1)
{
pfInfo[playerid][frakcioskinvalaszt]=pfInfo[playerid][frakcioskinvalaszt]+1;
if(pfInfo[playerid][frakcioskinvalaszt] < sizeof(orfkskin))
{
fskinchange(playerid,pfInfo[playerid][frakcioskinvalaszt]);
}else{
pfInfo[playerid][frakcioskinvalaszt]=0;
fskinchange(playerid,pfInfo[playerid][frakcioskinvalaszt]);
}
}
}
return 1;
}
format(query, sizeof(query), \"SELECT frakcioid,level,skin FROM `frakcio` WHERE `name` = \'%s\'\",jatekosnev(playerid));
mysql_query(query);
mysql_store_result();
mysql_fetch_row(line);
if(mysql_num_rows() != 0)
{
sscanf(line,\"p<|>ddd\",pfInfo[playerid][frakcioid],pfInfo[playerid][frakcioszint],pfInfo[playerid][frakcioskin]);
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt] =0;// itt mondjuk 0 zom de ha itt nem rakom be akkor nem nulláz disconnectnél
}else{
pfInfo[playerid][frakcioid]= 0;
pfInfo[playerid][frakcioszint]=0;
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskin]=0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt] =0; // és itt is
}
mysql_free_result();
lehet ez is kell nektek:
fskinchange(playerid,skinsor)
{
if(pfInfo[playerid][frakcioid] == 1)
{
pfInfo[playerid][frakcioskinvalaszt] = skinsor;
SetPlayerSkin(playerid,orfkskin[skinsor]);
SetPlayerFacingAngle( playerid, 90);
SetPlayerPos(playerid,1552.745361, -1681.317504, -6.737500);
SetPlayerCameraPos(playerid, 1550.152709, -1681.172485, -6.737500);
SetPlayerCameraLookAt(playerid, 1550.152709, -1681.172485, -6.737500);
TogglePlayerControllable(playerid,0);
}
return 1;
}
Elnézést a sok kódért.
public OnPlayerDisconnect(playerid, reason)
{
if(pInfo[playerid][foglalt] == 1)
{
if(pInfo[playerid][felvesz] == 1 || pInfo[pInfo[playerid][hivofel]][felvesz] == 1)
{
new string[500];
if(pInfo[playerid][hivo] == playerid)
{
format(string,sizeof string,\"A Hivó letette a telefont.\");
SendClientMessage(pInfo[playerid][hivofel], COLOR_YELLOW, string);
format(string,sizeof string,\"letetted a telefont.\");
SendClientMessage(playerid, COLOR_YELLOW, string);
KillTimer(AktivHivasTimer[playerid]);
pInfo[playerid][foglalt] = 0; // nem foglalt nekem is
pInfo[pInfo[playerid][hivofel]][foglalt] =0; // nem meg neki is
pInfo[pInfo[playerid][hivofel]][felvesz] = 0; // hivofel felveszt nullázuk
pInfo[pInfo[playerid][hivofel]][hivofel] = -1;
pInfo[playerid][hivo] = -1;
pInfo[playerid][hivofel] = -1;
}else{ // másik fél nem hívó
format(string,sizeof string,\"Hívott letette a telefont \");
SendClientMessage(pInfo[playerid][hivo], COLOR_YELLOW, string);
format(string,sizeof string,\"letetted a telefont.\");
SendClientMessage(playerid, COLOR_YELLOW, string);
KillTimer(AktivHivasTimer[pInfo[playerid][hivofel]]);
pInfo[playerid][foglalt] = 0; // nem foglalt nekem is
pInfo[pInfo[playerid][hivofel]][foglalt] = 0; // nem meg neki is
pInfo[playerid][felvesz] = 0;
pInfo[pInfo[playerid][hivofel]][hivofel] = -1;
pInfo[pInfo[playerid][hivofel]][hivo] = -1;
}
}
}
if(pInfo[playerid][pWeaponkezbeid] !=0 || pfInfo[playerid][frakciobavan]==0 )// kezében van fegyver és nem vok szolgálatba
{
new weapons[13][2],query[100];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);
if(weapons[0] == pInfo[playerid][pWeaponkezbeid])
{
pInfo[playerid][pWeaponAmmo][pInfo[playerid][pWeaponkezbeslot]] = weapons[1];
break;
}
}
format(query, sizeof(query), \"UPDATE `fegyverek` SET slot%d=\'%d %d\' WHERE jatekosnev=\'%s\'\",pInfo[playerid][pWeaponkezbeslot],pInfo[playerid][pWeaponid][pInfo[playerid][pWeaponkezbeslot]],pInfo[playerid][pWeaponAmmo][pInfo[playerid][pWeaponkezbeslot]],jatekosnev(playerid));
mysql_query(query);
}
businessid[playerid] = 0;
busy[playerid] = 0;
pInfo[playerid][login] = 0;
pInfo[playerid][penztarca]=0;
pInfo[playerid][skin]=0;
pInfo[playerid][gangid]=0;
pInfo[playerid][admin]=0;
pInfo[playerid][teltulaj]=0;
pInfo[playerid][telszam]=0;
pInfo[playerid][telegyenleg]=0;
pInfo[playerid][hivofel] = -1;
pInfo[playerid][hivo] = -1;
pInfo[playerid][felvesz] = 0;
pInfo[playerid][foglalt] = 0;
pfInfo[playerid][frakcioid]= 0;
pfInfo[playerid][frakcioszint]=0;
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskin] = 0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt]=0;// ezzel volt igazából baj
pBInfo[playerid][bankszamlaszam]=0;
pBInfo[playerid][bankosszeg]=0;
pInfo[playerid][frakciojarmuben] = -3;
pInfo[playerid][pWeaponkezbeid]=0;
pInfo[playerid][pWeaponkezbeslot] = 0;
return 1;
}
CMD:kov(playerid,parmas[])
{
if(pfInfo[playerid][frakcioskinvalasztoba]==1)// itt a lényeg
{
if(pfInfo[playerid][frakcioid] == 1)
{
pfInfo[playerid][frakcioskinvalaszt]=pfInfo[playerid][frakcioskinvalaszt]+1;
if(pfInfo[playerid][frakcioskinvalaszt] < sizeof(orfkskin))
{
fskinchange(playerid,pfInfo[playerid][frakcioskinvalaszt]);
}else{
pfInfo[playerid][frakcioskinvalaszt]=0;
fskinchange(playerid,pfInfo[playerid][frakcioskinvalaszt]);
}
}
}
return 1;
}
format(query, sizeof(query), \"SELECT frakcioid,level,skin FROM `frakcio` WHERE `name` = \'%s\'\",jatekosnev(playerid));
mysql_query(query);
mysql_store_result();
mysql_fetch_row(line);
if(mysql_num_rows() != 0)
{
sscanf(line,\"p<|>ddd\",pfInfo[playerid][frakcioid],pfInfo[playerid][frakcioszint],pfInfo[playerid][frakcioskin]);
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt] =0;// itt mondjuk 0 zom de ha itt nem rakom be akkor nem nulláz disconnectnél
}else{
pfInfo[playerid][frakcioid]= 0;
pfInfo[playerid][frakcioszint]=0;
pfInfo[playerid][frakciobavan]=0;
pfInfo[playerid][frakcioskin]=0;
pfInfo[playerid][frakcioskinvalasztoba]=0;
pfInfo[playerid][frakcioskinvalaszt] =0; // és itt is
}
mysql_free_result();
lehet ez is kell nektek:
fskinchange(playerid,skinsor)
{
if(pfInfo[playerid][frakcioid] == 1)
{
pfInfo[playerid][frakcioskinvalaszt] = skinsor;
SetPlayerSkin(playerid,orfkskin[skinsor]);
SetPlayerFacingAngle( playerid, 90);
SetPlayerPos(playerid,1552.745361, -1681.317504, -6.737500);
SetPlayerCameraPos(playerid, 1550.152709, -1681.172485, -6.737500);
SetPlayerCameraLookAt(playerid, 1550.152709, -1681.172485, -6.737500);
TogglePlayerControllable(playerid,0);
}
return 1;
}
Elnézést a sok kódért.