SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/09/2018, 09:55 AM   #1
priyanshu
Little Clucker
 
Join Date: Mar 2018
Location: India
Posts: 47
Reputation: 0
Default Help me pls

i am maked the clan bT but,
when i make someone bt level after next join/server restart it just reseted
how to fix this
priyanshu is offline   Reply With Quote
Old 09/09/2018, 10:01 AM   #2
priyanshu
Little Clucker
 
Join Date: Mar 2018
Location: India
Posts: 47
Reputation: 0
Default Re: Help me pls

pls help me
priyanshu is offline   Reply With Quote
Old 09/09/2018, 10:09 AM   #3
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,244
Reputation: 525
Default Re: Help me pls

24 hour bumps only...

This is going to need the command that you make them a clan member in, and show your Save Player function, and show where that function gets called in OnPlayerDisconnect.
Sew_Sumi is offline   Reply With Quote
Old 09/09/2018, 10:12 AM   #4
priyanshu
Little Clucker
 
Join Date: Mar 2018
Location: India
Posts: 47
Reputation: 0
Default Re: Help me pls

Quote:
Originally Posted by Sew_Sumi View Post
24 hour bumps only...

This is going to need the command that you make them a clan member in, and show your Save Player function, and show it where that function gets called in OnPlayerDisconnect.
everything is ok but its not saving
every next join/server restart its gone
it saving in files but not saving
priyanshu is offline   Reply With Quote
Old 09/09/2018, 10:12 AM   #5
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,244
Reputation: 525
Default Re: Help me pls

And that's why I asked for what I asked for...

And if it's saving in the file, then not working on relogging, then you need to show the load player function, and where that's called in the 'on login' loading, because obviously that can't be called in OnPlayerConnect or it will be insecure.
Sew_Sumi is offline   Reply With Quote
Old 09/09/2018, 10:25 AM   #6
priyanshu
Little Clucker
 
Join Date: Mar 2018
Location: India
Posts: 47
Reputation: 0
Default Re: Help me pls

CMDetbt(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][BT] < return ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "ERROR", "You need to be higher bT Level to use this command", "OK", "Cancel");
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setbt [playerid] [level]")
&&
SendClientMessage(playerid, orange, "Function: Will set the Level of bT of the Specific Player");
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(isnull(tmp2)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setbt [playerid] [level]")
&&
SendClientMessage(playerid, orange, "Function: Will set the Level of bT of the Specific Player");
level = strval(tmp2);

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(PlayerInfo[player1][LoggedIn] == 1) {
if(level > 10 ) return SendClientMessage(playerid,0xFF0000AA,"ERROR: Max bT Level is 10");
if(level == PlayerInfo[player1][BT]) return SendClientMessage(playerid,0xFF0000AA,"ERROR: Player is already this bT level");
CMDMessageToAdmins(playerid,"SetbT");
CMDMessageToBT(playerid,"SetbT");
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

if(level > 0) format(string,sizeof(string)," %s has set youre bT Status to level %d",adminname, level);
else format(string,sizeof(string)," %s has set youre bT Status to level %d",adminname, level);
SendClientMessage(player1,0x00FFFFAA,string);

if(level > PlayerInfo[player1][BT]) GameTextForPlayer(player1,"~g~bT LEVEL UP", 2000, 3);
else GameTextForPlayer(player1,"~r~bT LEVEL DOWN", 2000, 3);

format(string,sizeof(string),"You have made %s bT Level %d on %d/%d/%d at %d:%d:%d", playername, level, day, month, year, hour, minute, second); SendClientMessage(playerid,0x00FFFFAA,string);
format(string,sizeof(string),"%s has made %s bT Level %d on %d/%d/%d at %d:%d:%d",adminname, playername, level, day, month, year, hour, minute, second);
SaveToFile("btmembers",string);
dUserSetINT(PlayerName2(player1)).("bT",(level));
PlayerInfo[player1][BT] = level;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
} else return SendClientMessage(playerid,0xFF0000AA,"ERROR: Player must be registered and logged in to be set as a bT member");
} else return SendClientMessage(playerid, 0xFF0000AA, "Player is not connected");
} else return SendClientMessage(playerid,0xFF0000AA,"ERROR: You must be logged in to use this commands");
}
forward MessageToBT(color,const string[]);
public MessageToBT(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
if(PlayerInfo[i][BT] >= 1) {
if(PlayerInfo[i][LoggedIn] == 1) {
SendClientMessage(i, color, string); }
}
}
}
CMDMessageToBT(playerid,command[]) {
new string[128];
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"[bTMember] '%s' (Level: %d) | Command: %s",string,PlayerInfo[playerid][BT],command);
MessageToBT(blue,string);
return 1;
}

So, This IS the command now tell me
priyanshu is offline   Reply With Quote
Old 09/09/2018, 09:35 PM   #7
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,244
Reputation: 525
Default Re: Help me pls

Quote:
Originally Posted by priyanshu View Post
So, This IS the command now tell me
You need to pay attention to what I asked for... You've supplied the command, good job, but I also asked for other sections.

You've now given me the command I wanted in the first post, which is probably 1/2 of what I asked for in that post, then the subsequent post you told me it was saving, yet wasn't loading... So I asked for your load player function, and where it got called.


So again, read what's been put forward.


(Also, use [php][/php] tags, otherwise it just looks like a massive birdsnest and is unreadable.)
Sew_Sumi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 07:28 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.