Code is not functional - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Code is not functional (
/showthread.php?tid=579261)
Code is not functional -
JoshNudock - 25.06.2015
Hello! can someone help me please? I studied all day today the code below, the problem is that with this code enabled on the gamemode, nothing below it does not run (I think), it is used in Payday server, and when a person buys a room at the hotel
("PlayerInfo[i][pPhousekey] == -1"), the payday it is not executed, ie does not show your salary and etc .. if it is not a room in the hotel, the public payday, is executed usually .. can someone help me please?
PHP код:
new nome[MAX_PLAYER_NAME];
GetPlayerName(i, nome, sizeof(nome));
new key = PlayerInfo[i][pPhousekey];
if (PlayerInfo[i][pPhousekey] != 255)
{
rent = HouseInfo[key][hRent];
//if (PlayerInfo[i][pPhousekey] == -1) rent = 600;
if (strcmp(nome, HouseInfo[key][hOwner], true) == 0) rent = 0;
else if (account > rent)
{
PlayerInfo[i][pPhousekey] = 255;
SendClientMessage(i, -1, "You have been evicted from hotel / home for not having money to pay");
rent = 0;
}
HouseInfo[key][hTakings] = HouseInfo[key][hTakings] + rent;
}
new tmpintrate;
if (key != 255 && strcmp(nome, HouseInfo[key][hOwner], true) == 0)
{
if (PlayerInfo[i][pDonateRank] > 0) tmpintrate = intrate + 4;
else tmpintrate = intrate + 2;
}
else
{
if (PlayerInfo[i][pDonateRank] > 0) tmpintrate = 3;
else tmpintrate = 1;
}
Re: Code is not functional -
JoshNudock - 26.06.2015
up!!
Re: Code is not functional -
Prokill911 - 26.06.2015
You can't expect anyone to seriously post..
You've given code which makes no sense...
You need to post the full code block before you can expect anyone to know what you're trying to do...
Edit::
I Looked at your half cocked code...
and this should work...
PHP код:
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
new key = PlayerInfo[i][pPhousekey];
if(PlayerInfo[i][pPhousekey] != 255) {
rent = HouseInfo[key][hRent];
if(strcmp(name, HouseInfo[key][hOwner], true) == 0) {
rent = 0;
} else if(account < rent) { // Changed... As you were saying If their "Account" > GREATER than the rent.. It evicts.. Should be If they have no money Which is < Lower than rent
PlayerInfo[i][pPhousekey] = 255;
SendClientMessage(i, -1, "You have been evicted from hotel / home for not having money to pay");
rent = 0;
}
HouseInfo[key][hTakings] = HouseInfo[key][hTakings] += rent;
}
new tmpintrate;
if(key != 255 && strcmp(name, HouseInfo[key][hOwner], true) == 0) {
if (PlayerInfo[i][pDonateRank] > 0) {
tmpintrate = intrate += 4;
} else {
tmpintrate = intrate += 2;
}
} else {
if (PlayerInfo[i][pDonateRank] > 0) {
tmpintrate = 3;
} else {
tmpintrate = 1;
}
}