if(!sscanf(params,"s[16]s[16]s[16]d",action[0],action[1],action[2],amount)) { if(strcmp("open",action[0], true ) == 0) { } else if(strcmp("close",action[0], true ) == 0) { } if(strcmp("store",action[0], true ) == 0) { if(strcmp("weapon",action[1], true ) == 0) { } } }
if(sscanf(params,"s[16]s[16]s[16]d",action[0],action[1],action[2],amount)) return SendClientMessage(playerid, -1, "Incorrect format.");
try like this :
pawn Код:
|
COMMAND:trunk(playerid, params[]) { new action[3][16],amount; sscanf(params,"s[16]s[16]s[16]d",action[0],action[1],action[2],amount); if(strlen(action[0]) && strcmp("store",action[0], true ) == 0) { for(new slot = 0; slot < 5; slot++) if(slot == 0) break; if(strlen(action[1]) && strcmp("weapon",action[1], true ) == 0) { } if(strlen(action[1]) && strcmp("briefcase",action[1], true ) == 0) { } if(strlen(action[1]) && strcmp("materials",action[1], true ) == 0) { if(strlen(action[2]) && strcmp("A",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store materials A (amount > 0 < 50)"); } else if(strlen(action[2]) && strcmp("B",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store materials D (amount > 0 < 50)"); } else if(strlen(action[2]) && strcmp("C",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store materials C (amount > 0 < 50)"); } else if(strlen(action[2]) && strcmp("D",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store materials D (amount > 0 < 50)"); } else return SendPlayerError(playerid,"Usage: /trunk store materials (A,B,C,D)"); } if(strlen(action[1]) && strcmp("drugs",action[1], true ) == 0) { if(strlen(action[2]) && strcmp("A",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store drugs A (amount > 0 < 50)"); } else if(strlen(action[2]) && strcmp("B",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store drugs D (amount > 0 < 50)"); } else if(strlen(action[2]) && strcmp("C",action[2], true ) == 0) { if(amount < 1 || amount > 50) return SendPlayerError(playerid,"Usage: /trunk store drugs C (amount > 0 < 50)"); } else return SendPlayerError(playerid,"Usage: /trunk store drugs (A,B,C)"); } else return SendPlayerError(playerid,"Usage: /trunk store (weapon,briefcase,materials,drugs)."); } if(strlen(action[0]) && strcmp("take",action[0], true ) == 0) { new slot; if(sscanf(action[1],"%d",slot)) return SendPlayerError(playerid,"Usage: /trunk take (slot 0,1,2,3,4)."); if(slot < 0 && slot > 4) return SendPlayerError(playerid,"Usage: /trunk take (slot 0,1,2,3,4)."); } else if(strlen(action[0]) && strcmp("open",action[0], true ) == 0) { } else if(strlen(action[0]) && strcmp("close",action[0], true ) == 0) { } else return SendPlayerError(playerid,"Usage: /trunk (open - close - search - take - store)"); return 1; }