help please, thanks. - 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: help please, thanks. (
/showthread.php?tid=641608)
help please, thanks. -
Puff - 18.09.2017
PHP код:
#define MAX_CHARACTERS 3
PHP код:
ShowCharacterDialog(playerid) {
dialogstr[0] = 0;
tempstr[0] = 0;
new charname[MAX_PLAYER_NAME];
new pvarname[32];
new numchars = GetPVarInt(playerid,"NumCharacters");
for(new i=0;i<numchars;i++) {
format(pvarname,sizeof(pvarname),"CharUsername%d",i);
GetPVarString(playerid,pvarname,charname,sizeof(charname));
format(tempstr,sizeof(tempstr),"%s\n",charname);
strcat(dialogstr,tempstr,sizeof(dialogstr));
}
if(numchars < MAX_CHARACTERS) {
strcat(dialogstr,"Create Character",sizeof(dialogstr));
}
ShowPlayerDialog(playerid, _:EAccountDialog_ChooseCharacter, DIALOG_STYLE_LIST, "Choose your character",dialogstr,"Select", "Quit");
return 0;
}
It sets the MAX Characters to the defined limit.. but now I want to create a cmd where I want an admin to set char limit for each player using playerid but I do not know how I can I achieve that.. using the same function.
Re: help please, thanks. -
Sew_Sumi - 18.09.2017
it's to do with
Код:
if(numchars < MAX_CHARACTERS)
where it could be
Код:
if(numchars < MAX_CHARACTERS||numchars < PlayerCharLimit[playerid])
You will need to change in other areas to match this, such as where they select the character, and where they create their account.
Set PlayerCharLimit on creation, to MAX_CHARACTERS. Use the command to change PlayerCharLimit, and save it to the account, then make the login system load that limit once they login.