14.12.2012, 23:52
Bueno, hice un sistema de orina que metн dentro de mi gamemode, pero tengo un problema.. Se supone que yo quise hacer que al llegar a 100 de orina, uno orine automбticamente (se orine encima) y que al tener menos de 50 de orina, que no pueda orinar, pero mi problema es que al tener menos de 50, uno orina igual, y el progressbar que tendrнa que estar sobre el chaleco antibalas segъn mis coordenadas, no aparece..
Obviamente, hay muchos mбs aparte de jOrina, pero puse sуlo jOrina y jSexo que son los que importan (jSexo 1 es masculino, jSexo 2 es femenino)..
Йsta es la callback del payday, para que en cada payday vaya aumentando la orina..
Йsto para que se actualice.
Йstos son los comandos (/orinar para orinar, y /dorinar para dejar de orinar).
Creo que no hace falta poner la funciуn de PlayerName y la de ProxDetector..
No sй porque pasa eso, el GM copila perfectamente, sin ningъn warning.
Por cierto, tengo otra duda.. їquй diferencia hay entre OnPlayerUpdate y OnPlayerUpdateTime? їpuedo tener ambas callback en mi GM?
pawn Код:
new Orinando[MAX_PLAYERS];
new Bar: barraorina[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
#define COLOR_PURPLE 0xC2A2DAAA
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <progressbar>
pawn Код:
new Orinando[MAX_PLAYERS];
new Bar: barraorina[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_GRAD2 0xBFC0C2FF
pawn Код:
enum jInfo
{
jSexo,
jOrina
};
new JugadorInfo[MAX_PLAYERS][jInfo];
pawn Код:
public PayDay()
{
new string[128];
new account;
new interest,rent = 0, key;
PayDayLeft = 60;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(JugadorInfo[i][jNivel] > 0)
{
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
account = JugadorInfo[i][jCuenta];
if(key != 255)
{
rent = HouseInfo[key][hRent];
if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
{
rent = 0;
}
else if(rent > GetPlayerMoney(i))
{
HouseInfo[key][hRooms] += 1;
JugadorInfo[i][pPhousekey] = 999;
SendClientMessage(i, COLOR_BLANCO, "Usted ha sido desalojado de su casa, debido a que no pagу el alquiler.");
JugadorInfo[i][pRent] = 0;
rent = 0;
}
HouseInfo[key][hRentabil] = HouseInfo[key][hRentabil]+rent;
}
new tmpintrate;
Tax += TaxValue;//Should work for every player online
JugadorInfo[i][jCuenta] -= TaxValue;
new checks = 0;
account += checks;
interest = (JugadorInfo[i][jCuenta]/1000)*(tmpintrate);
JugadorInfo[i][jCuenta] = account+interest;
new ebill = 20;
if(JugadorInfo[i][pPhousekey] != 999 || JugadorInfo[i][pPbiskey] != 255)
{
JugadorInfo[i][jCuenta] -= ebill;
}
else
{
ebill = 0;
}
SendClientMessage(i, COLOR_ASKQ, "|___ Estado Bancario ___|");
format(string, sizeof(string), " Pago: $%d Impuestos: -$%d", checks, TaxValue);
SendClientMessage(i, COLOR_BLANCO, string);
if(JugadorInfo[i][pPhousekey] != 255 || JugadorInfo[i][pPbiskey] != 255)
{
format(string, sizeof(string), " Boleta de Electricidad: -$%d", ebill);
SendClientMessage(i, COLOR_GRAD1, string);
}
if(JugadorInfo[i][pSeguro] != 0)
{
SendClientMessage(i, COLOR_GRAD2, " Pago del Seguro: -$200");
Compra(i, 200)
}
format(string, sizeof(string), " Interйs $%d", interest);
SendClientMessage(i, COLOR_GRAD2, string);
format(string, sizeof(string), " Gastos totales: $%d", TaxValue + ebill);
SendClientMessage(i, COLOR_GRAD3, string);
format(string, sizeof(string), " Beneficios totales: $%d", checks-ebill-TaxValue);
SendClientMessage(i, COLOR_GRAD3, string);
SendClientMessage(i, 0xB6B6B6FF, "|--------------------------------------|");
format(string, sizeof(string), " Antiguo balance: %d$", JugadorInfo[i][jCuenta] - checks + ebill + TaxValue);
SendClientMessage(i, 0x00711DFF, string);
format(string, sizeof(string), " Nuevo balance: %d$", JugadorInfo[i][jCuenta]);
SendClientMessage(i, 0x00CC00FF, string);
format(string, sizeof(string), "~h~~g~dia de paga");
GameTextForPlayer(i, string, 5000, 1);
cNicotina[i] = 0; cEnergysil[i] = 0; cSIDA[i] = 0; cCancer[i] = 0; cEpilepsia[i] = 0;
JugadorInfo[i][pRob] = 0;
JugadorInfo[i][pConnectTime] += 1;
JugadorInfo[i][pExp]++;
JugadorInfo[i][jOrina] += 16.666666666666666666666666666667;
if(JugadorInfo[i][pContract] > 0){JugadorInfo[i][pContract] --;}
}
}
}
SaveAccounts();
return 1;
}
pawn Код:
forward OnPlayerUpdate(playerid);
public OnPlayerUpdate(playerid)
{
if(JugadorInfo[playerid][jOrina] == 50)
{
new string[128];
format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
SendClientMessage(playerid, -1, string);
}
if(JugadorInfo[playerid][jOrina] == 60)
{
new string[128];
format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 60%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
SendClientMessage(playerid, -1, string);
}
if(JugadorInfo[playerid][jOrina] == 80)
{
new string[128];
format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
SendClientMessage(playerid, -1, string);
}
if(JugadorInfo[playerid][jOrina] == 100)
{
new string[128];
format(string, sizeof(string), "%s se orina involuntariamente, debido a que no aguantу.", PlayerName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
JugadorInfo[playerid][jOrina] = 0;
Orinando[playerid] = 1;
SetPlayerSpecialAction(playerid,68);
SendClientMessage(playerid, -1, "ЎOh! {FF0000}se ha orinado encima. {FFFFFF}Que desilusiуn, la prуxima vez evite йsto.");
SendClientMessage(playerid, COLOR_GRAD2, "Utilice: /dorinar");
}
barraorina[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100);
ShowProgressBarForPlayer(playerid, barraorina[playerid]);
SetProgressBarValue(barraorina[playerid], JugadorInfo[playerid][jOrina]);
UpdateProgressBar(barraorina[playerid], playerid);
return 1;
}
pawn Код:
zcmd(orinar, playerid, params[])
{
if(JugadorInfo[playerid][jOrina] > 50) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no tiene ganas de orinar.");
if(Orinando[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Usted ya estб orinando.");
if(JugadorInfo[playerid][jSexo] == 1)
{
new string[256];
SetPlayerSpecialAction(playerid,68);
JugadorInfo[playerid][jOrina] = 0;
Orinando[playerid] = 1;
format(string, sizeof(string), "%s se baja el cierre de su pantalуn y comienza a orinar.", PlayerName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
}
else if(JugadorInfo[playerid][jSexo] == 2)
{
new string[256];
ApplyAnimation(playerid, "ped", "SEAT_down", 4.000000, 0, 0, 0, 1, 0);
JugadorInfo[playerid][jOrina] = 0;
Orinando[playerid] = 1;
format(string, sizeof(string), "%s se baja el cierre de su pantalуn, se sienta y comienza a orinar.", PlayerName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
}
return 1;
}
zcmd(dorinar, playerid, params[])
{
if(Orinando[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no estб orinando.");
if(JugadorInfo[playerid][jSexo] == 1)
{
new string[256];
Orinando[playerid] = 0;
ClearAnimations(playerid, 0);
format(string, sizeof(string), "%s para de orinar y se sube el cierre de su pantalуn.", PlayerName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
if(JugadorInfo[playerid][jSexo] == 2)
{
new string[256];
Orinando[playerid] = 0;
ClearAnimations(playerid, 0);
format(string, sizeof(string), "%s para de orinar, luego se sube el cierre del pantalуn y se levanta.", PlayerName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
No sй porque pasa eso, el GM copila perfectamente, sin ningъn warning.
Por cierto, tengo otra duda.. їquй diferencia hay entre OnPlayerUpdate y OnPlayerUpdateTime? їpuedo tener ambas callback en mi GM?