GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: jordanve le 09 Mars 2010, 22:35:12
-
Bonjour,
Je voudrais forcer la paye qui vient toutes les heures.
Un pote ma passé ce code ci dessous mais ça marque "Vous n'avez pas jouer ainser longtemp pour obtenir votre paye".
if(strcmp(cmd, "/payday", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vous devez d'abord vous identifiez !");
return 1;
}
if (PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'êtes pas autorisé à utilisez cette commande !");
return 1;
}
PayDay();
}
return 1;
}
Merci beaucoup
-
fait nous voir le payday :ohmy
-
Voilà :
public PayDay()
{
new string[128];
new account,interest;
new rent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pLevel] > 0)
{
if(MoneyMessage[i]==1)
{
SendClientMessage(i, COLOR_LIGHTRED, "Vous n'avez pas payé vos dette, vous allez en prison.");
GameTextForPlayer(i, "~r~Bousiller!", 2000, 1);
SetPlayerInterior(i, 6);
PlayerInfo[i][pInt] = 6;
SetPlayerPos(i, 264.6288,77.5742,1001.0391);
PlayerInfo[i][pJailed] = 1;
SafeResetPlayerWeapons(i);
SafeResetPlayerMoney(i);
WantedPoints[i] = 0;
PlayerInfo[i][pJailTime] = 240;
format(string, sizeof(string), "Vous êtes en prisons pour %d secondes. Caution: Incapable", PlayerInfo[i][pJailTime]);
SendClientMessage(i, COLOR_WHITE, string);
}
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
account = PlayerInfo[i][pAccount];
new key = PlayerInfo[i][pPhousekey];
if(key != 255)
{
rent = HouseInfo[key][hRent];
if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
{
rent = 0;
}
else if(rent > GetPlayerMoney(i))
{
PlayerInfo[i][pPhousekey] = 255;
SendClientMessage(i, COLOR_WHITE, "Vous avez été éjecté.");
rent = 0;
}
HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
}
new tmpintrate;
if (key != 255 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
{
if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+4; }
else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
}
else
{
if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 3; }
else { tmpintrate = 1; }
}
if(PlayerInfo[i][pPayDay] >= 6)
{
Tax += TaxValue;//Should work for every player online
PlayerInfo[i][pAccount] -= TaxValue;
new checks = PlayerInfo[i][pPayCheck] / 6;
if(PlayerInfo[i][pDonateRank] > 0)
{
new bonus = PlayerInfo[i][pPayCheck] / 10;
checks += bonus;
}
new ebill = (PlayerInfo[i][pAccount]/10000)*(PlayerInfo[i][pLevel]);
//ConsumingMoney[i] = 1;
//SafeGivePlayerMoney(i, checks);
account += checks;
if(PlayerInfo[i][pAccount] > 0)
{
PlayerInfo[i][pAccount] -= ebill;
SBizzInfo[4][sbTill] += ebill;
}
else
{
ebill = 0;
}
interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
PlayerInfo[i][pExp]++;
PlayerPlayMusic(i);
PlayerInfo[i][pAccount] = account+interest;
SendClientMessage(i, COLOR_GREEN, "|________________ Extrait de Compte ________________|");
format(string, sizeof(string), " Salaire HTC: $%d Taxe: -$%d", checks, TaxValue);
SendClientMessage(i, COLOR_WHITE, string);
if(PlayerInfo[i][pPhousekey] != 255 || PlayerInfo[i][pPbiskey] != 255)
{
format(string, sizeof(string), " Facture d'Electrécité: -$%d", ebill);
SendClientMessage(i, COLOR_WHITE, string);
}
format(string, sizeof(string), " Argent sur le compte avant paycheck: $%d", account - checks);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Interêt: 0.%d pourcent",tmpintrate);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Interêt Gagné $%d", interest);
SendClientMessage(i, COLOR_WHITE, string);
SendClientMessage(i, COLOR_GREEN, "|----------------------------------------------------|");
format(string, sizeof(string), " Argent sur le compte après paycheck: $%d", PlayerInfo[i][pAccount]);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Location: -$%d", rent);
SendClientMessage(i, COLOR_WHITE, string);
if(PlayerInfo[i][pHotel] == 1)
{
new hotelcost = BizzInfo[6][bEntranceCost];
format(string, sizeof(string), " Hotel: -$%d", hotelcost);
SendClientMessage(i, COLOR_WHITE, string);
BizzInfo[6][bTill] += BizzInfo[6][bEntranceCost];
ExtortionBiz(6, BizzInfo[6][bEntranceCost]);
BizzInfo[6][bProducts]--;
PlayerInfo[i][pAccount] -= hotelcost;
OnPropUpdate();
}
format(string, sizeof(string), "~y~PayDay~n~~w~Allez voir votre compte");
GameTextForPlayer(i, string, 5000, 1);
rent = 0;
PlayerInfo[i][pPayDay] = 0;
PlayerInfo[i][pPayCheck] = 0;
PlayerInfo[i][pConnectTime] += 1;
if(FarmerVar[i] == 0)
{
FarmerPickup[i][0] = 0;
}
if(DrugFarmerVar[i] == 0)
{
DrugFarmerPickup[i][0] = 0;
}
if(SmugglerWork[i] == 0)
{
PayDaySecure[i] = 0;
}
if(PlayerInfo[i][pDonateRank] > 0)
{
PlayerInfo[i][pPayDayHad] += 1;
if(PlayerInfo[i][pPayDayHad] >= 5)
{
PlayerInfo[i][pExp]++;
PlayerInfo[i][pPayDayHad] = 0;
}
}
}
else
{
SendClientMessage(i, COLOR_WHITE, "* Vous n'avez pas jouer assez longtemps pour obtenir votre paye.");
}
}
}
}
SaveAccounts();
Checkprop();
return 1;
}
-
je n'arive pas trop a lire ;D mais essaye secis ;)
if(strcmp(cmd, "/payday", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vous devez d'abord vous identifiez !");
return 1;
}
if (PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'êtes pas autorisé à utilisez cette commande !");
return 1;
}
PlayerInfo[playerid][pPayDay] = 7;
PayDay();
}
return 1;
}
-
Merci beaucoup ça fonctionne a merveille !
Bonne nuit
-
Sa marche pour toi mais pas pour les autre qui n'ont pas la variables a + de 7 :P
-
Un simple GetPlayerMoney puis une condition qui detecte s'il as l'argent qu'il faut puis un GivePlayerMoney en valeur negatif ferais l'affaire dans ce cas-ci alors :)
-
Bonjour, Oui Fredo à raison ! Pour cela tu a une solution tu le fait à chaque joueur connecté par son id approprié ! Et un giveplayerid suffit !
Code :
if(strcmp(cmd, "/payday", true) == 0) // By DiXoN
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vous devez d'abord vous identifiez !");
return 1;
}
tmp = strtok(cmdtext,idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /payday [playerid/partiDuNom]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Ce joueur n'est pas là");
return 1;
}
if (PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'êtes pas autorisé à utilisez cette commande !");
return 1;
}
PlayerInfo[giveplayerid][pPayDay] = 7;
PayDay();
}
return 1;
}
-
Mais non.. Ce qui veut, à mon avis, c'est forcer la paie à tous les joueurs connectés..
-
Salut
lol en faite je veux les 2 celle la de dixon et pour tous les joueurs. :-[
Merci
-
Faut trouver autre chose que giveplayerid.. Je suis en train de chercher une commande qui permet de faire une certaine chose à tous les joueurs..
genre un allplayerid ou autre..
-
Re, Voilà je ne l'ai pas re testé mais sa devrai être bon :
if(strcmp(cmd, "/payday", true) == 0) // By DiXoN
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vous devez d'abord vous identifiez !");
return 1;
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if (PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'êtes pas autorisé à utilisez cette commande !");
return 1;
}
PlayerInfo[playerid][pPayDay] = 5;
PayDay();
}
}
return 1;
}