13.01.2012, 01:33
Title ask's my question. So I will simply place the code here.
pawn Код:
enum cadeE {
sObjID,
Float:sPos[4],
sDeployer[MAX_PLAYER_NAME],
}
pawn Код:
cadeVariables[MAX_CADES][cadeE],
pawn Код:
if(GetPlayerState(playerid) == 2) {
for(new v; v < MAX_CADES; v++) {
if(cadeVariables[v][sPos][0] != 0 && cadeVariables[v][sPos][1] != 0 && cadeVariables[v][sPos][2] != 0) {
}
}
}
pawn Код:
CMD:deploycade(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1) {
if(GetPlayerState(playerid) == 1) {
new
x = -1,
string[76];
for(new i; i < MAX_CADES; i++) {
if(cadeVariables[i][sPos][0] == 0 && cadeVariables[i][sPos][1] == 0 && cadeVariables[i][sPos][2] == 0) {
x = i;
break;
}
}
if(x != -1) {
GetPlayerPos(playerid, cadeVariables[x][sPos][0], cadeVariables[x][sPos][1], cadeVariables[x][sPos][2]);
GetPlayerFacingAngle(playerid, cadeVariables[x][sPos][3]);
cadeVariables[x][sObjID] = CreateDynamicObject(981, cadeVariables[x][sPos][0], cadeVariables[x][sPos][1], cadeVariables[x][sPos][2] - 0.8, 0.0, 0.0, cadeVariables[x][sPos][3], GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 200.0);
GetPlayerName(playerid, cadeVariables[x][sDeployer], MAX_PLAYER_NAME);
format(string, sizeof(string), "* %s places out a Helix Road Barrier", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
format(string, sizeof(string),"You have successfully deployed a cade (ID %d).", x);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else {
format(string, sizeof(string), "No more cades can be deployed. (Limit %d)", MAX_CADES);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
else SendClientMessage(playerid, COLOR_GREY, "You can only deploy cades while on foot.");
}
return 1;
}
CMD:destroycade(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1) {
new
targetID,
string[75];
if(!isnull(params)) {
targetID = strval(params);
if(cadeVariables[targetID][sPos][0] != 0 && cadeVariables[targetID][sPos][1] != 0 && cadeVariables[targetID][sPos][2] != 0) {
DestroyDynamicObject(cadeVariables[targetID][sObjID]);
for(new i; i < 4; i++) cadeVariables[targetID][sPos][i] = 0;
cadeVariables[targetID][sObjID] = INVALID_OBJECT_ID;
format(cadeVariables[targetID][sDeployer], MAX_PLAYER_NAME, "(null)");
format(string, sizeof(string), "* %s picks up the Helix Road Barrier", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
format(string, sizeof(string), "You have successfully destroyed cade ID %d.", targetID);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid cade specified.");
}
else SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/destroycade [cade]");
}
return 1;
}