11.01.2010, 20:15
I'm having a problem with my /duty command, When i type /duty It gives me the weapons (this is for the Cops) but when i type /duty again i want it to disarm the people like they're going off duty It dosen't disarm them tho, Whats the problem i cant figure it out. I get no error while trying to compile the duty command
I'm also trying to make a dynamic house system for my Gamemode, Using the same thing i use to make Hqs dynamicly
Код:
if(strcmp(cmd, "/duty", true) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); if(forceteam && CopCheck(playerid)) { SendClientMessage(playerid, COLOR_GRAD2, " you are not a cop."); return 1; } if (gTeam[playerid] == 2) { if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerInfo[playerid][pLocal] != 255) { gTeam[playerid] = 2; SetPlayerToTeamColor(playerid); format(string, sizeof(string), "* %s Puts a gun and a badge in a locker", sendername); SetPlayerWeapons(playerid); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf("%s", string); return 1; } else { SendClientMessage(playerid, COLOR_GRAD2, " you are not in a locker room"); return 1; } } if (gTeam[playerid] == 3) { if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerInfo[playerid][pLocal] != 255) { gTeam[playerid] = 2; SetPlayerToTeamColor(playerid); if(PlayerInfo[playerid][pAdmin] == -2) { format(string, sizeof(string), "* Chief %s Takes a gun and a badge from a locker", sendername); } else { format(string, sizeof(string), "* Officer %s Takes a gun and a badge from a locker", sendername); } SetPlayerWeapons(playerid); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf("%s", string); return 1; } else { SendClientMessage(playerid, COLOR_GRAD2, " you are not in a locker room"); } } else { SendClientMessage(playerid, COLOR_GRAD2, " you are not part of a team"); return 1; } return 1; }
Код:
if(strcmp(cmd, "/sethousestat", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /sethousestat [House Id] [statcode] [amount]"); SendClientMessage(playerid, COLOR_GRAD4, "|1 Entrance* |2 Exit* |3 House id |4 Interior |5 House Level |6 House Discription "); SendClientMessage(playerid, COLOR_GRAD3, "*This stat code does not require a third value, enter anything"); return 1; } new hhid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /sethousestat [House Id] [statcode] [amount]"); SendClientMessage(playerid, COLOR_GRAD4, "|1 Entrance* |2 Exit* |3 House id |4 Interior |5 House Level |6 House Discription "); SendClientMessage(playerid, COLOR_GRAD3, "*This stat code does not require a third value, enter anything"); return 1; } new stat; stat = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /sethousestat [House Id] [statcode] [amount]"); SendClientMessage(playerid, COLOR_GRAD4, "|1 Entrance* |2 Exit* |3 House id |4 Interior |5 House Level |6 House Discription "); SendClientMessage(playerid, COLOR_GRAD3, "*This stat code does not require a third value, enter anything"); return 1; } new amount; amount = strval(tmp); if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1338) { switch (stat) { case 1: { new Float:shshx, Float:shshy, Float:shshz ; GetPlayerPos(playerid, shshx, shshy, shshz); hInfo[hhid][hEntrancex] = shshx; hInfo[hhid][hEntrancey] = shshy; hInfo[hhid][hEntrancez] = shshz; SendClientMessage(playerid, COLOR_GREEN, "House Entrance Set"); OnPropUpdate(); } case 2: { new Float:shshx, Float:shshy, Float:shshz ; GetPlayerPos(playerid, shshx, shshy, shshz); hInfo[hhid][hExitx] = shshx; hInfo[hhid][hExity] = shshy; hInfo[hhid][hExitz] = shshz; SendClientMessage(playerid, COLOR_GREEN, "House Exit Set"); OnPropUpdate(); } case 3: { hInfo[hhid][hValue] = amount; SendClientMessage(playerid, COLOR_GREEN, "House Value Set"); OnPropUpdate(); } case 4: { hInfo[hhid][hInt] = amount; SendClientMessage(playerid, COLOR_GREEN, "House Interior Set"); OnPropUpdate(); } case 5: { hInfo[hhid][hLevel] = amount; SendClientMessage(playerid, COLOR_GREEN, "House Level Set"); OnPropUpdate(); } case 6: { hInfo[hhid][hDiscription] = amount; SendClientMessage(playerid, COLOR_GREEN, "House Discription changed"); OnPropUpdate(); } default: { SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Stat Code"); } } } SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!"); return 1; }
Код:
C:\sa-mp server\gamemodes\stoney.pwn(8758) : error 028: invalid subscript (not an array or too many subscripts): "hInfo" C:\sa-mp server\gamemodes\stoney.pwn(8758) : warning 215: expression has no effect C:\sa-mp server\gamemodes\stoney.pwn(8758) : error 001: expected token: ";", but found "]" C:\sa-mp server\gamemodes\stoney.pwn(8758) : error 029: invalid expression, assumed zero C:\sa-mp server\gamemodes\stoney.pwn(8758) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.