So, I got to the part where you can actually sell the weapon. I made it do something like
to check if the player wanted to sell a bat, but it gave me array problems, so I tried strcmp, and it just isn't working.
Is there any way I can check if they typed the right weapon in weaponName without using strcmp?
Код:
dcmd_sellgun(playerid, params[])
{
new otherid, weaponName;
new string[64], PlayerName[24], matlist[100], matsep[100], armslevel1[100], armslevel2[100], armslevel3[100], armslevel4[100], armslevel5[100];
new number, armslevel;
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName));
number = dini_Int(string, "Job");
new MatA = dini_Int(string, "MatA");
new MatB = dini_Int(string, "MatB");
new MatC = dini_Int(string, "MatC");
armslevel = dini_Int(string, "ArmsDealerLevel");
format(matsep, sizeof(matsep), "--------------------------------[Guns You Can Sell]--------------------------------");
format(armslevel1, sizeof(armslevel1), "Level 1: Bat(A-200) | Cane(A-200) | Flowers(A-50) | Katana(A-200) | SDPistol(A-250)");
format(armslevel2, sizeof(armslevel2), "Level 2: Shotgun(A-300, B-300) | Rifle(B-500) | Small Vibrator(A-50, B-50)");
format(armslevel3, sizeof(armslevel3), "Level 3: MP5(C-500) | AK47(A-500, B-250 | Large Vibrator(A-100, B-100)");
format(armslevel4, sizeof(armslevel4), "Level 4: M4(B-500, C-500) | Purple Dildo (A-100, B-100, C-100)");
format(armslevel5, sizeof(armslevel5), "Level 5: SPAS12(B-500, C-1000)");
format(matlist, sizeof(matlist), "---------------[A - %d]---------------[B - %d]--------------[C - %d]---------------", MatA, MatB, MatC);
if(number != 6) return SendClientMessage(playerid, CHAT_COLOR_RED, "You are not an Arms Dealer!");
else if(sscanf(params, "rs[32]", otherid, weaponName) && (armslevel == 1)) SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matsep), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel1), SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matlist);
else if(sscanf(params, "rs[32]", otherid, weaponName) && (armslevel == 2)) SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matsep), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel1), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel2), SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matlist);
else if(sscanf(params, "rs[32]", otherid, weaponName) && (armslevel == 3)) SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matsep), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel1), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel2), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel3), SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matlist);
else if(sscanf(params, "rs[32]", otherid, weaponName) && (armslevel == 4)) SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matsep), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel1), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel2), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel3), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel4), SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matlist);
else if(sscanf(params, "rs[32]", otherid, weaponName) && (armslevel == 5)) SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matsep), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel1), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel2), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel3), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel4), SendClientMessage(playerid, CHAT_COLOR_WHITE, armslevel5), SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, matlist);
else if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!");
else
{
if(armslevel == 1)
{
if(strcmp(params, "Bat", true, 3))
{
GivePlayerWeapon(otherid, 5, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
}
else if(strcmp(params, "Cane", true, 4))
{
GivePlayerWeapon(otherid, 15, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
}
else if(strcmp(params, "Flowers", true, 7))
{
GivePlayerWeapon(otherid, 14, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
}
else if(strcmp(params, "Katana", true, 6))
{
GivePlayerWeapon(otherid, 8, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
}
else if(strcmp(params, "SDPistol", true, 8))
{
GivePlayerWeapon(otherid, 23, 10000);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
}
}
else if(armslevel == 2)
{
if(strcmp(params, "Bat", true, 3))
{
GivePlayerWeapon(otherid, 5, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
}
else if(strcmp(params, "Cane", true, 4))
{
GivePlayerWeapon(otherid, 15, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
}
else if(strcmp(params, "Flowers", true, 7))
{
GivePlayerWeapon(otherid, 14, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
}
else if(strcmp(params, "Katana", true, 6))
{
GivePlayerWeapon(otherid, 8, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
}
else if(strcmp(params, "SDPistol", true, 8))
{
GivePlayerWeapon(otherid, 23, 10000);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
}
}
else if(armslevel == 3)
{
if(strcmp(params, "Bat", true, 3))
{
GivePlayerWeapon(otherid, 5, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
}
else if(strcmp(params, "Cane", true, 4))
{
GivePlayerWeapon(otherid, 15, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
}
else if(strcmp(params, "Flowers", true, 7))
{
GivePlayerWeapon(otherid, 14, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
}
else if(strcmp(params, "Katana", true, 6))
{
GivePlayerWeapon(otherid, 8, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
}
else if(strcmp(params, "SDPistol", true, 8))
{
GivePlayerWeapon(otherid, 23, 10000);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
}
}
else if(armslevel == 4)
{
if(strcmp(params, "Bat", true, 3))
{
GivePlayerWeapon(otherid, 5, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
}
else if(strcmp(params, "Cane", true, 4))
{
GivePlayerWeapon(otherid, 15, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
}
else if(strcmp(params, "Flowers", true, 7))
{
GivePlayerWeapon(otherid, 14, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
}
else if(strcmp(params, "Katana", true, 6))
{
GivePlayerWeapon(otherid, 8, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
}
else if(strcmp(params, "SDPistol", true, 8))
{
GivePlayerWeapon(otherid, 23, 10000);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
}
}
else if(armslevel == 5)
{
if(strcmp(params, "Bat", true, 3))
{
GivePlayerWeapon(otherid, 5, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Bat works.");
}
else if(strcmp(params, "Cane", true, 4))
{
GivePlayerWeapon(otherid, 15, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Cane works.");
}
else if(strcmp(params, "Flowers", true, 7))
{
GivePlayerWeapon(otherid, 14, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Flowers works.");
}
else if(strcmp(params, "Katana", true, 6))
{
GivePlayerWeapon(otherid, 8, 1);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "Katana works.");
}
else if(strcmp(params, "SDPistol", true, 8))
{
GivePlayerWeapon(otherid, 23, 10000);
SendClientMessage(playerid, CHAT_COLOR_LIGHTBLUE, "SDPistol works.");
}
}
}
return 1;
}