help with /setrcash command
#1

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;
}
Reply
#2

Such poor scripting skills. I have no desire to read such.
Reply
#3

@Sledge, The only thing I see poor here is you. Grow the ___ up and start helping people. If your going to view someone's help topic don't gripe and complain about how they have things coded. Shut your mouth if you have nothing better to say. Don't act your IQ, act your age you immature scum. Sorry SA_MP admin for the raging, but it ticks me off when immature people act like this!

EDIT: I Don't know if this might be it or not but take a look at this:

pawn Код:
format(file, sizeof(file), "\\Users\\%s.ini", name);
Try this instead, its just a guess, I'm tired so I mean I dont know if it will work :P

pawn Код:
format(file, sizeof(file), "\\Users\\%s.ini", pname);
Sorry I am so tired I probably shouldnt be trying here lol....but I will try!
Reply
#4

I'm pretty sure it's:

\Users\%s.ini


NOT:

\\Users\\%s.ini

Try the one with just one backslash
Reply
#5

@ Crucix Thanks bro, thats probablky it more than what I post now that I have had some sleep. LOL what I posted made no sense. That makes sense due to the "\\" would block it form reading the correct location.
Reply
#6

Quote:
Originally Posted by Blade_Cervetti
Посмотреть сообщение
@ Crucix Thanks bro, thats probablky it more than what I post now that I have had some sleep. LOL what I posted made no sense. That makes sense due to the "\\" would block it form reading the correct location.
Oh i actually figured out the problem shortly after posting this, i just had to change the line:

format(string, sizeof(string), "You have set %s 's rcash to %d!", cash, name);

to

format(string, sizeof(string, "You have set %s 's rcash to %d, name, cash);

after reading it over carefully i few times i realized i had the name, cash order wrong and i thought that it would just affect the statement sent but it actually allowed the rcash value to be saved.

Also, Sledge, i don't claim to be good at scripting, obviously my scripting skills are poor because i am a beginner, if i was a skilled scripter i probably would have been able to figure this out without having to post here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)