problem with Property system
#1

Hello


I,have problem with this Property system: http://pastebin.com/wNgEvJrE


The problem is player when exit from the server his prop not reset
Reply
#2

??
Reply
#3

help please
Reply
#4

I don't get it, why do you want to reset the prop if someone exits?
The purpose of these property systems is to save and load (remember) the prop belonging to a player, so they don't have to buy it over and over again.

I might understand you wrong, if so, try to be more detailed.
Reply
#5

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
I don't get it, why do you want to reset the prop if someone exits?
The purpose of these property systems is to save and load (remember) the prop belonging to a player, so they don't have to buy it over and over again.

I might understand you wrong, if so, try to be more detailed.
I want to make when player disconnect his all properties become free.

Can you help me please?(sorry for english..)
Reply
#6

Try creating a reset function > IfPlayerIsLoggedIn = 0 if that doesn't work try setting a timer function that resets property after a certain amount of time
Reply
#7

Err, I guess you can do it by adding this under OnPlayerDisconnect
pawn Код:
new str[256];          
 GivePlayerMoney(playerid, PropVar[CurrentP[playerid]][PPrice]/2);
                format(PropVar[CurrentP[playerid]][POwner], 24, "None");
                PropVar[CurrentP[playerid]][PoID] = -1;
                format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[CurrentP[playerid]][PName], PropVar[CurrentP[playerid]][POwner], PropVar[CurrentP[playerid]][PPrice], PropVar[CurrentP[playerid]][PEarn]);
                Update3DTextLabelText(Pt[CurrentP[playerid]], 0xFFFFFFAA, str);
                CurrentP[playerid] = 0;
                HProps[playerid]--;
I copied this from the link you have in your main post, I searched for the sell part.
I think that if you just place it under OnPlayerDisconnect, as I said before, it works.
If there are errors, post them and we'll have a look.
Reply
#8

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Err, I guess you can do it by adding this under OnPlayerDisconnect
pawn Код:
new str[256];          
 GivePlayerMoney(playerid, PropVar[CurrentP[playerid]][PPrice]/2);
                format(PropVar[CurrentP[playerid]][POwner], 24, "None");
                PropVar[CurrentP[playerid]][PoID] = -1;
                format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[CurrentP[playerid]][PName], PropVar[CurrentP[playerid]][POwner], PropVar[CurrentP[playerid]][PPrice], PropVar[CurrentP[playerid]][PEarn]);
                Update3DTextLabelText(Pt[CurrentP[playerid]], 0xFFFFFFAA, str);
                CurrentP[playerid] = 0;
                HProps[playerid]--;
I copied this from the link you have in your main post, I searched for the sell part.
I think that if you just place it under OnPlayerDisconnect, as I said before, it works.
If there are errors, post them and we'll have a look.
It work but if i have more than 1 prop it not reset
Reply
#9

?
Reply
#10

Allright, check this code:
pawn Код:
new str[256],pName[32];
GetPlayerName(playerid,pName,32);
for(new i=0; i < sizeof(PropVar); i++)
{
    if(strcmp(PropVar[i][POwner],pName) != -1)
    {
        GivePlayerMoney(playerid, PropVar[i][PPrice]/2);
        format(PropVar[i][POwner], 24, "None");
        PropVar[i][PoID] = -1;
        format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[i][PName], PropVar[i][POwner], PropVar[i][PPrice], PropVar[i][PEarn]);
        Update3DTextLabelText(Pt[i], 0xFFFFFFAA, str);
        CurrentP[playerid] = 0;
        HProps[playerid]--;
    }
}
It loops trough the houses existing in the server, and if the player who's leaving is the owner, the prop is cleared.
Be sure to remove the old code I gave you, and put this in under OnPlayerDisconnect.
Since I don't really get where you save the total properties created, I used the max variable of another for loop I found in it.
Be sure to remove the old OnPlayerDisconnect code from my other post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)