15.12.2010, 21:42
The command works well in the server, if i type say, /setrcash 1000, and then do /rcash to view how much i have it will say 1000, however, after i leave the server, it returns to 0 rcash, how do i get it to remain at what i set it.
here is my OnPlayerDisconnect and dcmd_setrcash scripts.
public OnPlayerDisconnect(playerid, reason)
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
dini_IntSet(file, "adminlevel", Player[playerid][level]);
dini_IntSet(file, "Job", GetPlayerTeam(playerid));
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Rcash", Player[playerid][Rcash]);
logged[playerid] = 0;
return 1;
}
dcmd_setrcash(playerid, params[])
{
if(Player[playerid][level] < 4){
return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
}
new pID, cash;
if(sscanf(params,"ud",pID,cash)){
return SendClientMessage(playerid, COLOR_ORANGE, "USAGE : /setrcash [playerid | amount]");
}
else if(!IsPlayerConnected(pID)){
return SendClientMessage(playerid, COLOR_ORANGE, "Invalid player ID");
}
else
{
new file[128], string[128], string2[128], aname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(pID, name, sizeof(name));
format(file, sizeof(file), "\\Users\\%s.ini", name);
dini_IntSet(file, "Rcash", cash);
format(string, sizeof(string), "You have set %s 's rcash to %d!", cash, name);
format(string2, sizeof(string2), "Your Rcash has been set to %d by admin %s!", cash, aname);
SendClientMessage(playerid, COLOR_YELLOW, string);
SendClientMessage(pID, COLOR_YELLOW, string2);
}
return 1;
}
here is my OnPlayerDisconnect and dcmd_setrcash scripts.
public OnPlayerDisconnect(playerid, reason)
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
dini_IntSet(file, "adminlevel", Player[playerid][level]);
dini_IntSet(file, "Job", GetPlayerTeam(playerid));
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Rcash", Player[playerid][Rcash]);
logged[playerid] = 0;
return 1;
}
dcmd_setrcash(playerid, params[])
{
if(Player[playerid][level] < 4){
return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
}
new pID, cash;
if(sscanf(params,"ud",pID,cash)){
return SendClientMessage(playerid, COLOR_ORANGE, "USAGE : /setrcash [playerid | amount]");
}
else if(!IsPlayerConnected(pID)){
return SendClientMessage(playerid, COLOR_ORANGE, "Invalid player ID");
}
else
{
new file[128], string[128], string2[128], aname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(pID, name, sizeof(name));
format(file, sizeof(file), "\\Users\\%s.ini", name);
dini_IntSet(file, "Rcash", cash);
format(string, sizeof(string), "You have set %s 's rcash to %d!", cash, name);
format(string2, sizeof(string2), "Your Rcash has been set to %d by admin %s!", cash, aname);
SendClientMessage(playerid, COLOR_YELLOW, string);
SendClientMessage(pID, COLOR_YELLOW, string2);
}
return 1;
}