23.11.2014, 23:52
Hi all. I'm currently creating a roadblock command using OnPlayerModelSelection. For some reason though, the object is not added when selected. Below is the code. Any help would be appreciated!
Код:
new roadblocklist[10]={2892, 2899, 973,1424,1425,1427,1459,4508,1422,1423}; new activeroadblocks[20];
Код:
CMD:roadblock(playerid, params[]){ //PD ONLY if(pData[playerid][PdDuty] != 1) return SendClientMessage(playerid, COLOR_ERROR_RED, "You are not on duty!"); ShowModelSelectionMenuEx(playerid, roadblocklist, sizeof(roadblocklist), "Select Roadblock", DIALOG_PD_ROADBLOCK, 16.0, 0.0, -55.0); return 1; }
Код:
public OnPlayerModelSelection(playerid, response, listid, modelid) { if(listid == DIALOG_PD_ROADBLOCK){ if(response){ for(new i=0; i < sizeof(activeroadblocks); i++){ if(activeroadblocks[i] == 0){ new Float:x, Float:y, Float:z, Float:angle; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid,angle); activeroadblocks[i] = CreateDynamicObject(modelid, x, y, z-0.9, 0, 0, angle); SendClientMessage(playerid, COLOR_LIGHTBLUE, "You placed down a roadblock!"); break; }else if(i == sizeof(activeroadblocks) - 1){ SendClientMessage(playerid, COLOR_ERROR_RED, "There are already 20 roadblocks active. Please delete one first!"); } } } } return 1; }