Bohdan
Компетентный
Помогите перевести команды на zcmd с меня 10+.
Код:
if(!strcmp(cmd,"/online",true)) {
if(!pData[playerid][pFraction]) return SendClientMessage(playerid,CGRAY,"Вы не состоите во фракции");
new subfraction = GetSubfractionID(pData[playerid][pFraction] - 1);
if(subfraction == -1)
{
new mes[35];
format(mes,sizeof(mes),"%s:",gFractionName[pData[playerid][pFraction] - 1]);
SendClientMessage(playerid,CINFO,mes);
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(pData[i][pFraction] != pData[playerid][pFraction] - 1+1) continue;
format(mes,sizeof(mes),"%s [%d] Ранг: %d",pData[i][pNickname],i,pData[i][pRank]);
SendClientMessage(playerid,CSYSTEM,mes);
}
}
else
{
new subfractionid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) || !isNumeric(tmp)) subfractionid = pData[playerid][pSubfraction] - 1;
else subfractionid = strval(tmp)-1;
if(subfractionid < 0 || subfraction > 3 || !strlen(gSubfractionName[subfraction][subfractionid])) return SendClientMessage(playerid,CGRAY,"Неверный ID подфракции");
new mes[35];
format(mes,sizeof(mes),"%s:",gSubfractionName[subfraction][subfractionid]);
SendClientMessage(playerid,CINFO,mes);
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(pData[i][pFraction] != pData[playerid][pFraction] - 1+1 || pData[i][pSubfraction] != subfractionid + 1) continue;
format(mes,sizeof(mes),"%s [%d] Ранг: %d",pData[i][pNickname],i,pData[i][pRank]);
SendClientMessage(playerid,CSYSTEM,mes);
}
}
}
Код:
if(!strcmp(cmd,"/uninvite",true)) {
if(!pData[playerid][pFraction]) return SendClientMessage(playerid,CGRAY,"Вы не состоите во фракции");
if(!IsAbleToUninvite(playerid)) return SendClientMessage(playerid,CGRAY,"Ваш ранг недостаточен");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) || !isNumeric(tmp)) return SendClientMessage(playerid,CGRAY,"/uninvite [ID игрока] [причина]");
new actplayerid = strval(tmp);
if(!IsPlayerConnected(actplayerid) || actplayerid == playerid) return SendClientMessage(playerid,CGRAY,"Неверный ID игрока");
if(pData[actplayerid][pFraction] != pData[playerid][pFraction]) return SendClientMessage(playerid,CGRAY,"Игрок не состоит в вашей организации");
if(pData[actplayerid][pRank] >= pData[playerid][pRank]) return SendClientMessage(playerid,CGRAY,"Ваш ранг недостаточен");
new length = strlen(cmdtext);
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid,CGRAY,"/uninvite [ID игрока] [причина]");
new query[128];
format(query,sizeof(query),"UPDATE `accounts` SET `fraction` = '0', `rank` = '0', `fractionskin` = '0', `subfraction` = '0' WHERE `id` = '%d'",pData[actplayerid][pMysqlID]);
mysql_query(query);
if(mysql_errno()) return SendClientMessage(playerid,CRED,"Ошибка MySQL");
pData[actplayerid][pFraction] = 0;
pData[actplayerid][pRank] = 0;
pData[actplayerid][pFractionSkin] = 0;
pData[actplayerid][pSubfraction] = 0;
SetPlayerColor(actplayerid,0xFFFFFF11);
new houseid = pData[actplayerid][pHouse]-1;
if(!(houseid+1) || ((houseid+1) > 0 && pData[actplayerid][pMysqlID] != gHouses[houseid][houseOwnerID])) SetPlayerSkin(actplayerid,pData[actplayerid][pSkin]);
else if(!gHouses[houseid][houseImprove][3]) SetPlayerSkin(actplayerid,pData[actplayerid][pSkin]);
else
{
for(new x; x < 3; x ++) {
if(!gHouses[houseid][houseSkin]) continue;
pData[actplayerid][pSkin] = gHouses[houseid][houseSkin];
if(GetPlayerSkin(actplayerid) == gHouses[houseid][houseSkin][3]) SetPlayerSkin(actplayerid,pData[actplayerid][pSkin]);
}
gHouses[houseid][houseSkin][3] = 0;
UpdateHouseDress(houseid);
}
new mes[128];
format(mes,sizeof(mes),"%s уволил / выгнал Вас из организации,причина: %s.",pData[playerid][pNickname],(result));
SendClientMessage(actplayerid,CBADINFO,mes);
format(mes,sizeof(mes),"%s был уволен из организации",pData[actplayerid][pNickname]);
SendClientMessage(playerid,CINFO,mes);
}
Код:
CMD:lock(playerid,params[]){ new type = 1;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) || !isNumeric(tmp)) type = 1;
else type = strval(tmp);
if (type > 3 || type < 1) type = 1;
new carid;
if(pData[playerid][pCar] && type == 1) carid = pData[playerid][pCar];
else if(pData[playerid][pVehicleKey] && type == 3) carid = pData[playerid][pVehicleKey];
else if(type == 2) {
new vehicleid;
if(pData[playerid][pJob] == 1 && pTemp[playerid][pBusID] != INVALID_VEHICLE_ID)
{
vehicleid = pTemp[playerid][pBusID];
}
else if(pData[playerid][pJob] == 3 && pTemp[playerid][pTaxiID] != INVALID_PLAYER_ID)
{
vehicleid = pTemp[playerid][pTaxiID];
}
else if(pData[playerid][pJob] == 2 && pTemp[playerid][pTruckID] != INVALID_VEHICLE_ID)
{
vehicleid = pTemp[playerid][pTruckID];
}
else if(pData[playerid][pJob] == 4 && pTemp[playerid][pMechID] != INVALID_VEHICLE_ID )
{
vehicleid = pTemp[playerid][pMechID];
}
else if(pData[playerid][pJob] == 5 && pTemp[playerid][pDFTID] != INVALID_VEHICLE_ID )
{
vehicleid = pTemp[playerid][pDFTID];
}
else if(pTemp[playerid][pWork] == 1 && pTemp[playerid][pDozerID] != INVALID_VEHICLE_ID)
{
vehicleid = pTemp[playerid][pDozerID];
}
else return SendClientMessage(playerid,CGRAY,"У вас нет рабочего транспорта");
if(ToggleLock(vehicleid)) GameTextForPlayer(playerid,"~h~~r~locked",1500,3);
else GameTextForPlayer(playerid,"~h~~g~unlocked",1500,3);
PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
return 1;
}
else return SendClientMessage(playerid,CGRAY,"У Вас нет т/с");
new slot = GetCarSlot(carid);
new Float:x, Float:y, Float:z;
new vehicleid = gCars[slot][carVid];
GetVehiclePos(vehicleid,x,y,z);
new Float:x2,Float:y2,Float:z2;
GetPlayerPos(playerid,x2,y2,z2);
if(PointToPoint3D(x,y,z,x2,y2,z2) > 6.0) return SendClientMessage(playerid,CGRAY,"Вы далеко от своего т/с");
if(!gVehicles[vehicleid-1][vLock])
{
for(new i;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && IsVehicleStreamedIn(vehicleid,i)) SetVehicleParamsForPlayer(vehicleid,i,0,1);
gVehicles[vehicleid-1][vLock] = 1;
GameTextForPlayer(playerid,"~h~~r~locked",1500,3);
PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
}
else if(gVehicles[vehicleid-1][vLock])
{
for(new i;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && IsVehicleStreamedIn(vehicleid,i)) SetVehicleParamsForPlayer(vehicleid,i,0,0);
gVehicles[vehicleid-1][vLock] = 0;
GameTextForPlayer(playerid,"~h~~g~unlocked",1500,3);
PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
}
return 1;
}
Последнее редактирование:
