Дата: 08.12.2010, Среда, 18:12:02 | Сообщение # $NUMBER
Группа: Проверенные
Сообщений: 170
Здравствуйте форумчане. Собрал несколько команд и сейчас распишу, может кому нибудь понадобится. Список функций: - Запуск/Глушения двигателя;
- Включить/Выключить фары;
- Сигнализация;
- Неон для автомобиля;
- Очки на персонаже;
- Щит;
- Открыть/Закрыть капот;
- Открыть/Закрыть багажник.
1. Ко всем new добавить: Code new engine,lights,alarm,doors,bonnet,boot,objective; 2. Остальное добавлять в: Code public OnPlayerCommandText(playerid, cmdtext[]) Запуск/Глушение двигателя Code if(strcmp(cmd, "/start",true) == 0) { if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 1; } new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetPlayerName(playerid, sendername, sizeof(sendername)); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s вставляет ключ в зажигание, поворачивает ключ и заводит двигатель.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } return 1; } if(strcmp(cmd, "/stop",true) == 0) { if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 1; } new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetPlayerName(playerid, sendername, sizeof(sendername)); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s поворачивает ключ и заглушает двигатель.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } return 1; } Включить/Выключить фары (работают ночью) Code if(strcmp(cmd, "/lighton",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective); } return 1; } if(strcmp(cmd, "/lightoff",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective); } return 1; } Сигнализация Code if(strcmp(cmd, "/alarmon",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective); } return 1; } if(strcmp(cmd, "/alarmoff",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective); } } Неон для автомобиля Code if(strcmp("/neon", cmdtext, true, 10) == 0) { new neon = CreateObject(18648,0,0,0,0,0,0,100.0); new neon1 = CreateObject(18648,0,0,0,0,0,0,100.0); AttachObjectToVehicle(neon, GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(neon1, GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); SendClientMessage(playerid, COLOR_WHITE, "Вы установили неон на автомобиль."); return 1; } Очки на персонаже Code if(strcmp(cmd, "/очки", true) == 0) { SetPlayerAttachedObject(playerid,2, 19035, 2, 0.1, 0.03, 0.0, 0.0, 90.0, 90.0); return 1; } if(strcmp(cmd, "/очкиснять", true) == 0) { RemovePlayerAttachedObject(playerid, 2); return 1; } Щит (сразу сделал, чтобы могли использовать Полиция и ФБР) Code if(strcmp(cmd, "/shield", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) { if(shield[playerid] == 0) { SetPlayerAttachedObject(playerid, 1, 18637, 14, 0.0, 0.0, 0.0, 0.0, 180.0, 180.0); SetPlayerHealth(playerid, 999); shield[playerid] = 1; } else { RemovePlayerAttachedObject(playerid, 1); SetPlayerHealth(playerid, 50); shield[playerid] = 0; } } else { SendClientMessage(playerid, COLOR_GREY, "Вы не Полицейский/ФБР "); return 1; } return 1; } } Открыть/Закрыть капот Code if(strcmp(cmd, "/bonneton",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective); } return 1; } if(strcmp(cmd, "/bonnetoff",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective); } } Открыть/Закрыть багажник Code if(strcmp(cmd, "/booton",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); } return 1; } if(strcmp(cmd, "/bootoff",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); } }
|
Дата: 08.12.2010, Среда, 19:11:12 | Сообщение # $NUMBER
Группа: Проверенные
Сообщений: 170
Вот public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) Code public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) { if(IsPlayerConnected(playerid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); //radi = 2.0; //Trigger Radius for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))) { if(!BigEar[i]) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col5, string); } } else { SendClientMessage(i, col1, string); } } } }//not connected return 1; }
|
Дата: 08.12.2010, Среда, 19:21:42 | Сообщение # $NUMBER
Группа: Пользователи
Сообщений: 144
ааааДобавлено (08.12.2010, 19.20) --------------------------------------------- вобщем смотрите что получилось forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5); new engine,lights,alarm,doors,bonnet,boot,objective; public OnPlayerCommandText(playerid, cmdtext[]) if(strcmp(cmd, "/start",true) == 0) { if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 1; } new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetPlayerName(playerid, sendername, sizeof(sendername)); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s âñòàâëÿåò êëþ÷ â çàæèãàíèå, ïîâîðà÷èâàåò êëþ÷ è çàâîäèò äâèãàòåëü.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } return 1; } if(strcmp(cmd, "/stop",true) == 0) { if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { return 1; } new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { GetPlayerName(playerid, sendername, sizeof(sendername)); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s ïîâîðà÷èâàåò êëþ÷ è çàãëóøàåò äâèãàòåëü.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } return 1; } public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) { if(IsPlayerConnected(playerid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); //radi = 2.0; //Trigger Radius for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))) { if(!BigEar[i]) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col5, string); } } else { SendClientMessage(i, col1, string); } } } }//not connected return 1; } и выдаёт ошибки D:\samp ñåðâåðà\samp 03c\gamemodes\lvdm1.pwn(2475) : error 017: undefined symbol "BigEar" D:\samp ñåðâåðà\samp 03c\gamemodes\lvdm1.pwn(2475) : warning 215: expression has no effect D:\samp ñåðâåðà\samp 03c\gamemodes\lvdm1.pwn(2475) : error 001: expected token: ";", but found "]" D:\samp ñåðâåðà\samp 03c\gamemodes\lvdm1.pwn(2475) : error 029: invalid expression, assumed zero D:\samp ñåðâåðà\samp 03c\gamemodes\lvdm1.pwn(2475) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. Добавлено (08.12.2010, 19.21) --------------------------------------------- помогите. а?
|