Help -
NealPeteros - 09.10.2016
Please help.
PHP код:
stock LearnDialog(playerid)
{
new string[613];
new hstring[65];
format(hstring, sizeof(hstring), "Choose the skill/ability you wish to learn: (%d Learning Points)", PlayerInfo[playerid][pLearn]);
switch(PlayerInfo[playerid][pSpecial])
{
case 1://Humans
{
format(string, sizeof(string), "Unarmed/Strength (Learned Rank: %d/3)\nKnife (Learned Rank: %d/5)\nKatana (Learned Rank: %d/3)\nColt 45 (Learned Rank: %d/3)\n",PlayerInfo[playerid][Unarmed],PlayerInfo[playerid][Knife],PlayerInfo[playerid][Katana], PlayerInfo[playerid][Colt45]);
format(string, sizeof(string), "Silenced Pistol/Tazer (Learned Rank: %d/3)\nDesert Eagle (Learned Rank: %d/6)\nShotgun (Learned Rank: %d/3)\nSPAS12 (Learned Rank: %d/6)\nTEC9/UZI (Learned Rank: %d/3)\nMP5 (Learned Rank: %d/6)\nAK47 (Learned Rank: %d/6)\nM4A1 (Learned Rank: %d/6)\nRifle (Learned Rank: %d/6)",
PlayerInfo[playerid][Tazer], PlayerInfo[playerid][Deagle], PlayerInfo[playerid][Shotgun], PlayerInfo[playerid][SPAS], PlayerInfo[playerid][UZI], PlayerInfo[playerid][MP5], PlayerInfo[playerid][AK], PlayerInfo[playerid][M4], PlayerInfo[playerid][Rifle]);
ShowPlayerDialog(playerid, DIALOG_LEARN, DIALOG_STYLE_LIST, hstring, string, "Learn", "Cancel");
return 1;
}
}
return 1;
}
It shows a dialog when this function is called. Here's the dialog
PHP код:
if(dialogid == DIALOG_LEARN)
{
if(response)
{
new string[90];
if(listitem == 0)
{
if(PlayerInfo[playerid][pLearn] > 0)
{
if(PlayerInfo[playerid][Unarmed] < 3)
{
PlayerInfo[playerid][pLearn] --;
PlayerInfo[playerid][Unarmed] ++;
format(string, sizeof(string), "SERVER: You have learned the Unarmed/Strength skill Rank %d. (/combatstyle)", PlayerInfo[playerid][Unarmed]);
SendClientMessage(playerid,COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot spend any more learning points on Unarmed/Strength skill. You have mastered it.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have any Learning Points to spend.");
}
}
else if(listitem == 1)
{
if(PlayerInfo[playerid][pLearn] > 0)
{
if(PlayerInfo[playerid][Knife] < 5)
{
PlayerInfo[playerid][pLearn] --;
PlayerInfo[playerid][Knife] ++;
format(string, sizeof(string), "SERVER: You have learned the Knife skill Rank %d.", PlayerInfo[playerid][Knife]);
SendClientMessage(playerid, COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot spend any more learning points on Knife skill. You have mastered it.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have any Learning Points to spend.");
}
}
else if(listitem == 2)
{
if(PlayerInfo[playerid][pLearn] > 0)
{
if(PlayerInfo[playerid][Katana] < 5)
{
PlayerInfo[playerid][pLearn] --;
PlayerInfo[playerid][Katana] ++;
format(string, sizeof(string), "SERVER: You have learned the Katana skill Rank %d.", PlayerInfo[playerid][Katana]);
SendClientMessage(playerid, COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot spend any more learning points on Katana skill. You have mastered it.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have any Learning Points to spend.");
}
}
else if(listitem == 3)
{
if(PlayerInfo[playerid][pLearn] > 0)
{
if(PlayerInfo[playerid][Colt45] < 5)
{
PlayerInfo[playerid][pLearn] --;
PlayerInfo[playerid][Colt45] ++;
format(string, sizeof(string), "SERVER: You have learned the Colt 45 skill Rank %d.", PlayerInfo[playerid][Colt45]);
SendClientMessage(playerid, COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot spend any more learning points on Colt 45 skill. You have mastered it.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have any Learning Points to spend.");
}
}
else if(listitem == 4)
{
if(PlayerInfo[playerid][pLearn] > 0)
{
if(PlayerInfo[playerid][Tazer] < 5)
{
PlayerInfo[playerid][pLearn] --;
PlayerInfo[playerid][Tazer] ++;
format(string, sizeof(string), "SERVER: You have learned the Silenced Pistol/Tazer skill Rank %d.", PlayerInfo[playerid][Tazer]);
SendClientMessage(playerid, COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot spend any more learning points on Silenced Pistol/Tazer skill. You have mastered it.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have any Learning Points to spend.");
}
}
}
return 1;
}
Problem here is that when I upgrade my skill, for example Unarmed Strength, it shows the
Код:
format(string, sizeof(string), "SERVER: You have learned the Unarmed/Strength skill Rank %d. (/combatstyle)", PlayerInfo[playerid][Unarmed]);
But in the dialog of the LearnDialog function, it doesn't show the %d part or the
Код:
(Learned Rank: %d/3)
part. Still says 0/3.
Re: Help -
Mencent - 09.10.2016
Hello!
You Format the string two times but don't put the first string into the second string.
I hope you know what I mean.
PHP код:
stock LearnDialog(playerid)
{
new string[613];
new hstring[65];
format(hstring, sizeof(hstring), "Choose the skill/ability you wish to learn: (%d Learning Points)", PlayerInfo[playerid][pLearn]);
switch(PlayerInfo[playerid][pSpecial])
{
case 1://Humans
{
format(string, sizeof(string), "Unarmed/Strength (Learned Rank: %d/3)\nKnife (Learned Rank: %d/5)\nKatana (Learned Rank: %d/3)\nColt 45 (Learned Rank: %d/3)\n",PlayerInfo[playerid][Unarmed],PlayerInfo[playerid][Knife],PlayerInfo[playerid][Katana], PlayerInfo[playerid][Colt45]);
format(string, sizeof(string), "%sSilenced Pistol/Tazer (Learned Rank: %d/3)\nDesert Eagle (Learned Rank: %d/6)\nShotgun (Learned Rank: %d/3)\nSPAS12 (Learned Rank: %d/6)\nTEC9/UZI (Learned Rank: %d/3)\nMP5 (Learned Rank: %d/6)\nAK47 (Learned Rank: %d/6)\nM4A1 (Learned Rank: %d/6)\nRifle (Learned Rank: %d/6)",
string,PlayerInfo[playerid][Tazer], PlayerInfo[playerid][Deagle], PlayerInfo[playerid][Shotgun], PlayerInfo[playerid][SPAS], PlayerInfo[playerid][UZI], PlayerInfo[playerid][MP5], PlayerInfo[playerid][AK], PlayerInfo[playerid][M4], PlayerInfo[playerid][Rifle]);
ShowPlayerDialog(playerid, DIALOG_LEARN, DIALOG_STYLE_LIST, hstring, string, "Learn", "Cancel");
return 1;
}
}
return 1;
}
Do it like this. Does it work?
Re: Help -
Skimmer - 09.10.2016
Try this.
pawn Код:
case 1://Humans
{
format(string, sizeof(string), "Unarmed/Strength (Learned Rank: %d/3)\nKnife (Learned Rank: %d/5)\nKatana (Learned Rank: %d/3)\nColt 45 (Learned Rank: %d/3)\n",PlayerInfo[playerid][Unarmed],PlayerInfo[playerid][Knife],PlayerInfo[playerid][Katana], PlayerInfo[playerid][Colt45]);
format(string, sizeof(string), "%sSilenced Pistol/Tazer (Learned Rank: %d/3)\nDesert Eagle (Learned Rank: %d/6)\nShotgun (Learned Rank: %d/3)\nSPAS12 (Learned Rank: %d/6)\nTEC9/UZI (Learned Rank: %d/3)\nMP5 (Learned Rank: %d/6)\nAK47 (Learned Rank: %d/6)\nM4A1 (Learned Rank: %d/6)\nRifle (Learned Rank: %d/6)",
string, PlayerInfo[playerid][Tazer], PlayerInfo[playerid][Deagle], PlayerInfo[playerid][Shotgun], PlayerInfo[playerid][SPAS], PlayerInfo[playerid][UZI], PlayerInfo[playerid][MP5], PlayerInfo[playerid][AK], PlayerInfo[playerid][M4], PlayerInfo[playerid][Rifle]);
ShowPlayerDialog(playerid, DIALOG_LEARN, DIALOG_STYLE_LIST, hstring, string, "Learn", "Cancel");
return 1;
}