28.12.2013, 08:19
i will change my Scratch code to Zcmd. anyone can help me how to change it ?
if(strcmp(cmd, "/creategarage", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 99999) { tmp = strtok(cmdtext, idx); if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]"); new price = strval(tmp); tmp = strtok(cmdtext, idx); if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]"); new size = strval(tmp); if (size < 1 || size > 3) return SendClientMessage(playerid, GREY, "Invalid size."); new location[32]; new Float:x, Float:y, Float:z; new id = GetAvailableID(TYPE_GARAGE); if (id == -1) return SendClientMessage(playerid, GREY, " Garages are at their maximum. Cannot continue."); GarageIDTaken[id] = 1; GetPlayerPos(playerid, x, y, z); GarageInfo[id][GarageEnterX] = x; GarageInfo[id][GarageEnterY] = y; GarageInfo[id][GarageEnterZ] = z; GarageInfo[id][GaragePickup] = CreateDynamicPickup(1239, 23, x, y, z); GarageInfo[id][GarageOwned] = 0; GarageInfo[id][GaragePrice] = price; GarageInfo[id][GarageVirtual] = id; GarageInfo[id][GarageInsideX] = 0; GarageInfo[id][GarageInsideY] = 0; GarageInfo[id][GarageInsideZ] = 0; GarageInfo[id][GarageInsideA] = 0; GarageInfo[id][GarageExitX] = 0; GarageInfo[id][GarageExitY] = 0; GarageInfo[id][GarageExitZ] = 0; GarageInfo[id][GarageExitA] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); GarageInfo[id][GarageSize] = 0; Get2DZone(location, MAX_ZONE_NAME, x, y, z); format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}None\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", location); GarageInfo[id][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, x, y, z, 10.0, 0); SendClientMessage(playerid, LIGHTBLUE, "Garage created, now use /editgarage [id] to edit it."); format(string, sizeof(string), "The garage ID is: %d (you can use this id to /editgarage with it).", id); SendClientMessage(playerid, LIGHTBLUE, string); SetGarageSize(id, size); SaveGarages(); garages++; return 1; } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; } if(strcmp(cmd, "/deletegarage", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/deletegarage [id]"); return 1; } new id = strval(tmp); if(!GarageIDTaken[id]) return SendClientMessage(playerid, GREY, "ID is not taken."); GarageIDTaken[id] = 0; GarageInfo[id][GarageOwned] = 0; GarageInfo[id][GaragePrice] = 0; GarageInfo[id][GarageVirtual] = id; GarageInfo[id][GarageEnterX] = 0; GarageInfo[id][GarageEnterY] = 0; GarageInfo[id][GarageEnterZ] = 0; GarageInfo[id][GarageInsideX] = 0; GarageInfo[id][GarageInsideY] = 0; GarageInfo[id][GarageInsideZ] = 0; GarageInfo[id][GarageInsideA] = 0; GarageInfo[id][GarageExitX] = 0; GarageInfo[id][GarageExitY] = 0; GarageInfo[id][GarageExitZ] = 0; GarageInfo[id][GarageExitA] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); GarageInfo[id][GarageSize] = 0; DestroyDynamicPickup(GarageInfo[id][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[id][GarageLabel]); SendClientMessage(playerid, LIGHTBLUE, "Garage deleted."); SaveGarages(); garages--; return 1; } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; } if(strcmp(cmd, "/deletegarages", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 100000) { for(new id = 0; id < MAX_GARAGES; id++) { if(GarageIDTaken[id]) { GarageIDTaken[id] = 0; GarageInfo[id][GarageOwned] = 0; GarageInfo[id][GaragePrice] = 0; GarageInfo[id][GarageVirtual] = 0; GarageInfo[id][GarageEnterX] = 0; GarageInfo[id][GarageEnterY] = 0; GarageInfo[id][GarageEnterZ] = 0; GarageInfo[id][GarageInsideX] = 0; GarageInfo[id][GarageInsideY] = 0; GarageInfo[id][GarageInsideZ] = 0; GarageInfo[id][GarageInsideA] = 0; GarageInfo[id][GarageExitX] = 0; GarageInfo[id][GarageExitY] = 0; GarageInfo[id][GarageExitZ] = 0; GarageInfo[id][GarageExitA] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); GarageInfo[id][GarageSize] = 0; DestroyDynamicPickup(GarageInfo[id][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[id][GarageLabel]); } } garages = 0; SendClientMessage(playerid, LIGHTBLUE, "Garages deleted."); if(fexist("garages.cfg")) { fremove("garages.cfg"); } } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; } if(strcmp(cmd, "/editgarage", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/editgarage [id] [name] [amount]"); SendClientMessage(playerid, GREY, "Available names: enter, exit, price, size"); return 1; } new garage = strval(tmp); if(garage < 1 || garage > MAX_GARAGES) { format(string, sizeof(string), "Garage cannot be below 1 or above %d.", MAX_GARAGES); SendClientMessage(playerid, GREY, string); return 1; } if(!GarageIDTaken[garage]) return SendClientMessage(playerid, GREY, "ID not taken."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/editgarage [id] [name] [amount]"); SendClientMessage(playerid, GREY, "Available names: enter, exit, price, size"); return 1; } if(strcmp(tmp,"enter",true) == 0) { new Float:x, Float:y, Float:z, size[32], location[MAX_ZONE_NAME]; if(GarageInfo[garage][GarageSize] == 0) { size = "None"; } if(GarageInfo[garage][GarageSize] == 1) { size = "Small"; } if(GarageInfo[garage][GarageSize] == 2) { size = "Medium"; } if(GarageInfo[garage][GarageSize] == 3) { size = "Large"; } DestroyDynamicPickup(GarageInfo[garage][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage][GarageLabel]); GetPlayerPos(playerid, x, y, z); GarageInfo[garage][GarageEnterX] = x; GarageInfo[garage][GarageEnterY] = y; GarageInfo[garage][GarageEnterZ] = z; GarageInfo[garage][GaragePickup] = CreateDynamicPickup(1239, 23, x, y, z); Get2DZone(location, MAX_ZONE_NAME, x, y, z); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage][GarageOwner], size, location); GarageInfo[garage][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, x, y, z, 10.0, 0); SaveGarages(); return 1; } if(strcmp(tmp,"exit",true) == 0) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); GarageInfo[garage][GarageExitX] = x; GarageInfo[garage][GarageExitY] = y; GarageInfo[garage][GarageExitZ] = z; GarageInfo[garage][GarageExitA] = a; SaveGarages(); return 1; } if(strcmp(tmp,"price",true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/editgarage [id] [price] [amount]"); return 1; } new amount = strval(tmp); GarageInfo[garage][GaragePrice] = amount; SaveGarages(); return 1; } if(strcmp(tmp,"size",true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/editgarage [id] [size] [1(small) - 2(medium) - 3(large)]"); return 1; } new size = strval(tmp), sizey[32], location[MAX_ZONE_NAME]; if(size < 1 || size > 3) { SendClientMessage(playerid, GREY, "Size cannot be below 1, or above 3."); return 1; } if(size == 1) { GarageInfo[garage][GarageInsideX] = 613.4373; GarageInfo[garage][GarageInsideY] = -75.7534; GarageInfo[garage][GarageInsideZ] = 997.9922; GarageInfo[garage][GarageInsideA] = 277.1663; sizey = "Small"; } if(size == 2) { GarageInfo[garage][GarageInsideX] = 615.2148; GarageInfo[garage][GarageInsideY] = -125.0944; GarageInfo[garage][GarageInsideZ] = 997.9922; GarageInfo[garage][GarageInsideA] = 88.5923; sizey = "Medium"; } if(size == 3) { GarageInfo[garage][GarageInsideX] = 614.9040; GarageInfo[garage][GarageInsideY] = -3.4428; GarageInfo[garage][GarageInsideZ] = 1000.9219; GarageInfo[garage][GarageInsideA] = 86.3912; sizey = "Large"; } DestroyDynamicPickup(GarageInfo[garage][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage][GarageLabel]); GarageInfo[garage][GarageSize] = size; GarageInfo[garage][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage][GarageOwner], sizey, location); GarageInfo[garage][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ], 10.0, 0); SaveGarages(); return 1; } } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; } if(strcmp(cmd, "/upgradegarage", true) == 0) { if(IsPlayerConnected(playerid)) { new garage = PlayerInfo[playerid][pGarageKey]; new garage2 = PlayerInfo[playerid][pGarageKey2]; if(garage == -1 && garage2 == -1) return SendClientMessage(playerid, GREY, " You don't own a garage."); else { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/upgradegarage [1/2] [small $50k/medium $100k/large $250k]"); return 1; } new slot = strval(tmp); if (slot < 1 || slot > 2) return SendClientMessage(playerid, GREY, "Slot can't be below 1, or above 2."); if (slot == 1) { if (PlayerInfo[playerid][pGarageKey] == -1) return SendClientMessage(playerid, GREY, " You don't own a garage in this slot."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/upgradegarage [1/2] [small $50k/medium $100k/large $250k]"); return 1; } new price; new sizey[32], location[MAX_ZONE_NAME], Float:tmpinsidex, Float:tmpinsidey, Float:tmpinsidez, Float:tmpinsidea; if(strcmp(tmp, "small", true) == 0) { tmpinsidex = 613.4373; tmpinsidey = -75.7534; tmpinsidez = 997.9922; tmpinsidea = 277.1663; sizey = "Small"; price = 50000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage][GarageLabel]); GarageInfo[garage][GarageSize] = 1; GarageInfo[garage][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage][GarageOwner], sizey, location); GarageInfo[garage][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage][GarageInsideX] = tmpinsidex; GarageInfo[garage][GarageInsideY] = tmpinsidey; GarageInfo[garage][GarageInsideZ] = tmpinsidez; GarageInfo[garage][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } if(strcmp(tmp, "medium", true) == 0) { tmpinsidex = 615.2148; tmpinsidey = -125.0944; tmpinsidez = 997.9922; tmpinsidea = 88.5923; sizey = "Medium"; price = 100000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage][GarageLabel]); GarageInfo[garage][GarageSize] = 2; GarageInfo[garage][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage][GarageOwner], sizey, location); GarageInfo[garage][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage][GarageInsideX] = tmpinsidex; GarageInfo[garage][GarageInsideY] = tmpinsidey; GarageInfo[garage][GarageInsideZ] = tmpinsidez; GarageInfo[garage][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } if(strcmp(tmp, "large", true) == 0) { tmpinsidex = 614.9040; tmpinsidey = -3.4428; tmpinsidez = 1000.9219; tmpinsidea = 86.3912; sizey = "Large"; price = 250000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage][GarageLabel]); GarageInfo[garage][GarageSize] = 3; GarageInfo[garage][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage][GarageOwner], sizey, location); GarageInfo[garage][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage][GarageEnterX], GarageInfo[garage][GarageEnterY], GarageInfo[garage][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage][GarageInsideX] = tmpinsidex; GarageInfo[garage][GarageInsideY] = tmpinsidey; GarageInfo[garage][GarageInsideZ] = tmpinsidez; GarageInfo[garage][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } } if (slot == 2) { if (PlayerInfo[playerid][pGarageKey2] == -1) return SendClientMessage(playerid, GREY, " You don't own a garage in this slot."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/upgradegarage [1/2] [small ($100,000) - medium ($300,000) - large ($500,000)]"); return 1; } new price; new sizey[32], location[MAX_ZONE_NAME], Float:tmpinsidex, Float:tmpinsidey, Float:tmpinsidez, Float:tmpinsidea; if(strcmp(tmp, "small", true) == 0) { tmpinsidex = 613.4373; tmpinsidey = -75.7534; tmpinsidez = 997.9922; tmpinsidea = 277.1663; sizey = "Small"; price = 50000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage2][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage2][GarageLabel]); GarageInfo[garage2][GarageSize] = 1; GarageInfo[garage2][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage2][GarageOwner], sizey, location); GarageInfo[garage2][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage2][GarageInsideX] = tmpinsidex; GarageInfo[garage2][GarageInsideY] = tmpinsidey; GarageInfo[garage2][GarageInsideZ] = tmpinsidez; GarageInfo[garage2][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } if(strcmp(tmp, "medium", true) == 0) { tmpinsidex = 615.2148; tmpinsidey = -125.0944; tmpinsidez = 997.9922; tmpinsidea = 88.5923; sizey = "Medium"; price = 100000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage2][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage2][GarageLabel]); GarageInfo[garage2][GarageSize] = 2; GarageInfo[garage2][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage2][GarageOwner], sizey, location); GarageInfo[garage2][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage2][GarageInsideX] = tmpinsidex; GarageInfo[garage2][GarageInsideY] = tmpinsidey; GarageInfo[garage2][GarageInsideZ] = tmpinsidez; GarageInfo[garage2][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } if(strcmp(tmp, "large", true) == 0) { tmpinsidex = 614.9040; tmpinsidey = -3.4428; tmpinsidez = 1000.9219; tmpinsidea = 86.3912; sizey = "Large"; price = 250000; if(GetMoney(playerid) >= price) { DestroyDynamicPickup(GarageInfo[garage2][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[garage2][GarageLabel]); GarageInfo[garage2][GarageSize] = 3; GarageInfo[garage2][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} %s\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", GarageInfo[garage2][GarageOwner], sizey, location); GarageInfo[garage2][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[garage2][GarageEnterX], GarageInfo[garage2][GarageEnterY], GarageInfo[garage2][GarageEnterZ], 10.0, 0); SaveGarages(); GiveMoney(playerid, -price); format(string, sizeof(string), "* Garage upgraded/downgraded to size %s for $%d.", sizey, price); SendClientMessage(playerid, LIGHTBLUE, string); GarageInfo[garage2][GarageInsideX] = tmpinsidex; GarageInfo[garage2][GarageInsideY] = tmpinsidey; GarageInfo[garage2][GarageInsideZ] = tmpinsidez; GarageInfo[garage2][GarageInsideA] = tmpinsidea; return 1; } else { SendClientMessage(playerid, GREY, " You cannot afford this."); return 1; } } } } } return 1; } if(strcmp(cmd, "/asellgarage", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/asellgarage [id]"); return 1; } new id = strval(tmp); if(id < 1 || id > MAX_GARAGES) { format(string, sizeof(string), "Garage cannot be below 1 or above %d.", MAX_GARAGES); SendClientMessage(playerid, GREY, string); return 1; } if(!GarageInfo[id][GarageOwned]) return SendClientMessage(playerid, GREY, "Garage not owned."); GarageInfo[id][GarageOwned] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); SendClientMessage(playerid, LIGHTBLUE, "Garage sold."); for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[i][pGarageKey] == id) { PlayerInfo[i][pGarageKey] = -1; } } GarageInfo[id][GarageOwned] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); new size[32], location[MAX_ZONE_NAME]; if(GarageInfo[id][GarageSize] == 1) { size = "Small"; } if(GarageInfo[id][GarageSize] == 2) { size = "Medium"; } if(GarageInfo[id][GarageSize] == 3) { size = "Large"; } DestroyDynamicPickup(GarageInfo[id][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[id][GarageLabel]); GarageInfo[id][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[id][GarageEnterX], GarageInfo[id][GarageEnterY], GarageInfo[id][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[id][GarageEnterX], GarageInfo[id][GarageEnterY], GarageInfo[id][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", size, location); GarageInfo[id][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[id][GarageEnterX], GarageInfo[id][GarageEnterY], GarageInfo[id][GarageEnterZ], 10.0, 0); SaveGarages(); return 1; } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; } if(strcmp(cmd, "/garageid", true) == 0) { if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid,GREY,"You're not authorized to use this command."); new garage = IsPlayerNearGarage(playerid); if(garage == -1) return SendClientMessage(playerid,GREY, " You must be near the garage you wish to check the ID of."); format(string, sizeof(string), "* Garage ID: %d",garage); SendClientMessage(playerid, LIGHTBLUE, string); return 1; } if(strcmp(cmd, "/buygarage", true) == 0) { new i = IsPlayerNearGarage(playerid); if (i == -1) return SendClientMessage(playerid, GREY, " You are not near a garage that's for sale."); if(IsPlayerConnected(playerid)) { if(IsPlayerNearGarage(playerid)) { if(PlayerInfo[playerid][pGarageKey] != -1 && PlayerInfo[playerid][pGarageKey2] != -1) return SendClientMessage(playerid, GREY, " You already own 2 garages."); if(GarageInfo[i][GarageOwned] == 0) { // edited by emmet for es-rp v1.1-november 17 new size[32]; if(GarageInfo[i][GarageSize] == 1) size = "Small"; if(GarageInfo[i][GarageSize] == 2) size = "Medium"; if(GarageInfo[i][GarageSize] == 3) size = "Large"; SetPVarInt(playerid, "GarageToBuy", i); SetPVarInt(playerid, "GaragePrice", GarageInfo[i][GaragePrice]); format(string, sizeof(string), "Are you sure you would like to purchase this %s sized garage for $%d?", size, GarageInfo[i][GaragePrice]); ShowPlayerDialog(playerid, 5499, DIALOG_STYLE_MSGBOX, "Garage Purchase Confirmation", string, "Yes", "No"); return 1; } else { SendClientMessage(playerid, GREY, "Garage is already owned."); return 1; } } } return 1; } if(strcmp(cmd, "/sellgarage", true) == 0) { if(IsPlayerConnected(playerid)) { new i = PlayerInfo[playerid][pGarageKey]; new i2 = PlayerInfo[playerid][pGarageKey2]; if(i == -1 && i2 == -1) return SendClientMessage(playerid, GREY, " You don't own a garage."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/sellgarage [1/2] [confirm]"); return 1; } new slot = strval(tmp); if (slot < 1 || slot > 2) return SendClientMessage(playerid, GREY, "Slot can't be below 1, or above 2."); if (slot == 1) { if (PlayerInfo[playerid][pGarageKey] == -1) return SendClientMessage(playerid, GREY, " You don't own a garage in this slot."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/sellgarage [1/2] [confirm]"); format(string, sizeof(string), "Your garage is worth $%d. Are you really sure you wanna sell it?", GarageInfo[i][GaragePrice] / 100 * 80); SendClientMessage(playerid, YELLOW, string); return 1; } if(strcmp(tmp,"confirm",true) == 0) { GiveMoney(playerid, GarageInfo[i][GaragePrice] / 100 * 80); GarageInfo[i][GarageOwned] = 0; strmid(GarageInfo[i][GarageOwner], "The State", 0, strlen("The State"), 255); format(string, sizeof(string), "Congratulations, you have successfully sold your garage for $%d.", GarageInfo[i][GaragePrice] / 100 * 80); SendClientMessage(playerid, YELLOW, string); new size[32], location[MAX_ZONE_NAME]; if(GarageInfo[i][GarageSize] == 1) { size = "Small"; } if(GarageInfo[i][GarageSize] == 2) { size = "Medium"; } if(GarageInfo[i][GarageSize] == 3) { size = "Large"; } DestroyDynamicPickup(GarageInfo[i][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[i][GarageLabel]); GarageInfo[i][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[i][GarageEnterX], GarageInfo[i][GarageEnterY], GarageInfo[i][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[i][GarageEnterX], GarageInfo[i][GarageEnterY], GarageInfo[i][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", size, location); GarageInfo[i][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[i][GarageEnterX], GarageInfo[i][GarageEnterY], GarageInfo[i][GarageEnterZ], 10.0, 0); PlayerInfo[playerid][pGarageKey] = -1; SaveGarages(); return 1; } } if (slot == 2) { if (PlayerInfo[playerid][pGarageKey2] == -1) return SendClientMessage(playerid, GREY, " You don't own a garage in this slot."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/sellgarage [1/2] [confirm]"); format(string, sizeof(string), "Your garage is worth $%d. Are you really sure you wanna sell it?", GarageInfo[i2][GaragePrice] / 100 * 80); SendClientMessage(playerid, YELLOW, string); return 1; } if(strcmp(tmp,"confirm",true) == 0) { GiveMoney(playerid, GarageInfo[i2][GaragePrice] / 100 * 80); GarageInfo[i2][GarageOwned] = 0; strmid(GarageInfo[i2][GarageOwner], "The State", 0, strlen("The State"), 255); format(string, sizeof(string), "Congratulations, you have successfully sold your garage for $%d.", GarageInfo[i2][GaragePrice] / 100 * 80); SendClientMessage(playerid, YELLOW, string); new size[32], location[MAX_ZONE_NAME]; if(GarageInfo[i2][GarageSize] == 1) { size = "Small"; } if(GarageInfo[i2][GarageSize] == 2) { size = "Medium"; } if(GarageInfo[i2][GarageSize] == 3) { size = "Large"; } DestroyDynamicPickup(GarageInfo[i2][GaragePickup]); DestroyDynamic3DTextLabel(GarageInfo[i2][GarageLabel]); GarageInfo[i2][GaragePickup] = CreateDynamicPickup(1239, 23, GarageInfo[i2][GarageEnterX], GarageInfo[i2][GarageEnterY], GarageInfo[i2][GarageEnterZ]); Get2DZone(location, MAX_ZONE_NAME, GarageInfo[i2][GarageEnterX], GarageInfo[i2][GarageEnterY], GarageInfo[i2][GarageEnterZ]); format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}%s\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", size, location); GarageInfo[i2][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, GarageInfo[i2][GarageEnterX], GarageInfo[i2][GarageEnterY], GarageInfo[i2][GarageEnterZ], 10.0, 0); PlayerInfo[playerid][pGarageKey2] = -1; SaveGarages(); return 1; } } } return 1; } if(strcmp(cmd, "/entergarage", true) == 0 || strcmp(cmd, "/enterga", true) == 0) { if(IsPlayerConnected(playerid)) { new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS]; new i = IsPlayerNearGarage(playerid), intoset, vehicleid; if(i == -1) return SendClientMessage(playerid, GREY, " You are not near a garage."); if(GarageInfo[i][GarageSize] == 1) { intoset = 2; } if(GarageInfo[i][GarageSize] == 2) { intoset = 3; } if(GarageInfo[i][GarageSize] == 3) { intoset = 1; } if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, GREY, "This garage is locked."); if(IsPlayerInRangeOfPoint(playerid, 5.5, GarageInfo[i][GarageEnterX], GarageInfo[i][GarageEnterY], GarageInfo[i][GarageEnterZ])) { if(GetPlayerState(playerid) == 2) { vehicleid = GetPlayerVehicleID(playerid); SetVehiclePos(vehicleid, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ] + 0.4); SetVehicleZAngle(vehicleid, GarageInfo[i][GarageInsideA]); SetVehicleWorld(vehicleid, i); SetVehicleInterior(vehicleid, intoset); for(new j = 0; j < MAX_PLAYERS; j++) { if(IsPlayerInVehicle(j, vehicleid)) { InCar[j] = vehicleid; Seat[j] = GetPlayerVehicleSeat(j); SetPlayerInterior(j, intoset); SetPlayerVirtualWorld(j, i); SetPVarInt(j, "InGarage", 1); } } } SetPlayerPosEx(playerid, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]); SetPlayerFacingAngle(playerid, GarageInfo[i][GarageInsideA]); SetPlayerInterior(playerid, intoset); SetPlayerVirtualWorld(playerid, i); if (vehicleid != 0) { for (new j = 0; j < MAX_PLAYERS; j++) { if (InCar[j] == 0) continue; if (InCar[j] == vehicleid) { PutPlayerInVehicle(j, vehicleid, Seat[j]); } } } SetPVarInt(playerid, "InGarage", 1); OnPlayerEnterGarage(playerid, i); return 1; } else { SendClientMessage(playerid, GREY, " You are not near a garage."); return 1; } } return 1; } if(strcmp(cmd, "/exitgarage", true) == 0 || strcmp(cmd, "/exitga", true) == 0) { if(IsPlayerConnected(playerid)) { new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS]; new i = GetPlayerVirtualWorld(playerid), vehicleid; if(i == 0) return SendClientMessage(playerid, GREY, " You are not inside a garage."); if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, GREY, " You've been locked inside the garage, tough luck."); if(IsPlayerInRangeOfPoint(playerid, 30.0, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]) && GetPlayerVirtualWorld(playerid) == i) { if(GetPlayerState(playerid) == 2) { vehicleid = GetPlayerVehicleID(playerid); for(new j = 0; j < MAX_PLAYERS; j++) { if(IsPlayerInVehicle(j, vehicleid)) { InCar[j] = vehicleid; Seat[j] = GetPlayerVehicleSeat(playerid); SetPlayerInterior(j, 0); SetPlayerVirtualWorld(j, 0); SetPVarInt(j, "InGarage", 0); } } SetVehiclePos(vehicleid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]); SetVehicleZAngle(vehicleid, GarageInfo[i][GarageExitA]); SetVehicleWorld(vehicleid, 0); SetVehicleInterior(vehicleid, 0); } SetPlayerPosEx(playerid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]); SetPlayerFacingAngle(playerid, GarageInfo[i][GarageExitA]); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); if(vehicleid != 0) { for (new j = 0; j < MAX_PLAYERS; j++) { if (InCar[j] == 0) continue; if (InCar[j] == vehicleid) { PutPlayerInVehicle(j, vehicleid, Seat[j]); } } PutPlayerInVehicle(playerid, vehicleid, 0); } SetPVarInt(playerid, "InGarage", 0); return 1; } else { SendClientMessage(playerid, GREY, " You are not near a garage exit."); return 1; } } return 1; }
COMMAND:mycommand(playerid, params[]) // or CMD:mycommand(playerid, params[])
if(strcmp(cmd, "/mycommand", true) == 0)
if(strcmp(cmd, "/mycommand", true) == 0)
CMD:mycommand(playerid, params[])
#include <zcmd>
COMMAND:creategarage(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]");
new price = strval(tmp);
tmp = strtok(cmdtext, idx);
if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]");
new size = strval(tmp);
if (size < 1 || size > 3) return SendClientMessage(playerid, GREY, "Invalid size.");
new location[32];
new Float:x, Float:y, Float:z;
new id = GetAvailableID(TYPE_GARAGE);
if (id == -1) return SendClientMessage(playerid, GREY, " Garages are at their maximum. Cannot continue.");
GarageIDTaken[id] = 1;
GetPlayerPos(playerid, x, y, z);
GarageInfo[id][GarageEnterX] = x;
GarageInfo[id][GarageEnterY] = y;
GarageInfo[id][GarageEnterZ] = z;
GarageInfo[id][GaragePickup] = CreateDynamicPickup(1239, 23, x, y, z);
GarageInfo[id][GarageOwned] = 0;
GarageInfo[id][GaragePrice] = price;
GarageInfo[id][GarageVirtual] = id;
GarageInfo[id][GarageInsideX] = 0;
GarageInfo[id][GarageInsideY] = 0;
GarageInfo[id][GarageInsideZ] = 0;
GarageInfo[id][GarageInsideA] = 0;
GarageInfo[id][GarageExitX] = 0;
GarageInfo[id][GarageExitY] = 0;
GarageInfo[id][GarageExitZ] = 0;
GarageInfo[id][GarageExitA] = 0;
strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255);
GarageInfo[id][GarageSize] = 0;
Get2DZone(location, MAX_ZONE_NAME, x, y, z);
format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}None\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", location);
GarageInfo[id][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, x, y, z, 10.0, 0);
SendClientMessage(playerid, LIGHTBLUE, "Garage created, now use /editgarage [id] to edit it.");
format(string, sizeof(string), "The garage ID is: %d (you can use this id to /editgarage with it).", id);
SendClientMessage(playerid, LIGHTBLUE, string);
SetGarageSize(id, size);
SaveGarages();
garages++;
return 1;
}
else
{
SendClientMessage(playerid, GREY, " You are not authorized to use that command.");
}
return 1;
}
COMMAND:yourcmdhere(playerid, params[])
{
//yourcommand
}
return 1;