dcmd_sellgun(playerid, params[]) { new string[64], PlayerName[24]; new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); new number; new StringLength; new id; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName)); number = dini_Int(string, "Job"); StringLength = strlen(params); id = ReturnPlayerID(tmp); if(number == 6) { if(StringLength == 7) { SendClientMessage(playerid, CHAT_COLOR_RED, "Works"); } else if(id == INVALID_PLAYER_ID) { SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!"); } else { SendClientMessage(playerid, CHAT_COLOR_RED, "Test"); } } else if(number != 6) { SendClientMessage(playerid, CHAT_COLOR_RED, "You are not a Arms Dealer!"); } return 1; }
dcmd_sellgun( playerid, params[] ) { new otherid, wepname[50], idx; if( sscanf( params, "us", otherid, wepname ) ) //show list here else //show other code here return 1; }
dcmd_sellgun( playerid, params[] ) { new otherid, wepname[50]; new string[64], PlayerName[24]; new number; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName)); number = dini_Int(string, "Job"); if(sscanf(params, "us", otherid, wepname)) { if(number == 6) { if(otherid == INVALID_PLAYER_ID) { SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!"); } else { SendClientMessage(playerid, CHAT_COLOR_RED, "Works"); } } } else { if(number == 6) { SendClientMessage(playerid, CHAT_COLOR_RED, "Gun List"); } else if(number != 6) { SendClientMessage(playerid, CHAT_COLOR_RED, "You are not an Arms Dealer!"); } } return 1; }
dcmd_sellgun( playerid, params[] )
{
new otherid, wepname[50];
new string[64], PlayerName[24];
new number;
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string),"xadmin/Users/%s.ini", udb_encode(PlayerName));
number = dini_Int(string, "Job");
if(number != 6) return SendClientMessage(playerid, CHAT_COLOR_RED, "You are not an Arms Dealer!");
else if(sscanf(params, "us", otherid, wepname)) return SendClientMessage(playerid, CHAT_COLOR_RED, "Use: Blah!");
else if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, CHAT_COLOR_RED, "Invalid Player ID!");
else
{
SendClientMessage(playerid, CHAT_COLOR_RED, "Works");
SendClientMessage(playerid, CHAT_COLOR_RED, "Yeey :D");
}
return 1;
}
if(weaponName == "bat")
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; }
So, I got to the part where you can actually sell the weapon. I made it do something like
Код:
if(weaponName == "bat") Is there any way I can check if they typed the right weapon in weaponName without using strcmp? |
if(!strcmp(weaponName, "Bat", true))
{
//Do your stuff!
}
C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1002) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1007) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1012) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1017) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1022) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1030) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1035) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1040) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1045) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1050) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1058) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1063) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1068) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1073) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1078) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1086) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1091) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1096) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1101) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1106) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1114) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1119) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1124) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1129) : error 035: argument type mismatch (argument 1) C:\Users\Josh\Desktop\CGRP 0.3b\gamemodes\cgroleplay.pwn(1134) : error 035: argument type mismatch (argument 1) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 25 Errors.