Дмитрий |
Дата: Понедельник, 09.04.2012, 17:49 | Сообщение # 1 | Сообщить о нерабочей теме
|
Регистрация: | 03.12.2011
|
Страна: | Российская Федерация |
Репутация: |
14
|
Сообщений: | 1421 |
Награды: |
4
+
|
Статус: |
|
| Итак,начнём. В начало мода
Code #define VehicleSpeed_1 false #define VehicleSpeed_2 true #define VehicleSpeed_A 0 #define VehicleSpeed_B 6
new bool:R_Vehicle[MAX_PLAYERS] = false; new PlayerText3D:stext[MAX_PLAYERS]; new PlayerText3D:stext2[MAX_PLAYERS]; new Speed[MAX_PLAYERS];
Далее в public OnPlayerDisconnect(playerid, reason) Вставляем
Code R_Vehicle[playerid] = VehicleSpeed_1;
В public OnPlayerSpawn(playerid)
Code R_Vehicle[playerid] = VehicleSpeed_1;
В public OnPlayerDeath(playerid, killerid, reason)
Code R_Vehicle[playerid] = VehicleSpeed_1;
в public OnGameModeExit()
Code for(new i = 0; i < MAX_PLAYERS; i++) { DeletePlayer3DTextLabel(i,stext[i]); }
Если этого паблика у вас нету,вот собранный уже,просто вставить во все public
Code public OnGameModeExit() { for(new i = 0; i < MAX_PLAYERS; i++) { DeletePlayer3DTextLabel(i,stext[i]); } return 1; }
в public OnPlayerStateChange(playerid, newstate, oldstate)
Code if(newstate == PLAYER_STATE_DRIVER) { stext[playerid] = CreatePlayer3DTextLabel(playerid,"KM/H",0x008080FF,0,-2.1,0.25,10.0,INVALID_PLAYER_ID,GetPlayerVehicleID(playerid),1); stext2[playerid] = CreatePlayer3DTextLabel(playerid,"{006400}[ ]",0x008080FF,0,-2.1,0.1,10.0,INVALID_PLAYER_ID,GetPlayerVehicleID(playerid),1); R_Vehicle[playerid] = VehicleSpeed_2; } else if(newstate == PLAYER_STATE_ONFOOT) { R_Vehicle[playerid] = VehicleSpeed_1; DeletePlayer3DTextLabel(playerid,stext[playerid]); DeletePlayer3DTextLabel(playerid,stext2[playerid]);
}
в public OnPlayerExitVehicle
Code R_Vehicle[playerid] = VehicleSpeed_1;
В public OnPlayerUpdate(playerid)
Code if(IsPlayerInAnyVehicle(playerid)) { if(bool:R_Vehicle[playerid] == VehicleSpeed_2) { static UpdateSpeed_R[MAX_PLAYERS]; if(UpdateSpeed_R[playerid] >= VehicleSpeed_B) { new string[64]; new string2[64]; Speed[playerid] = GetPlayerSpeed(playerid); string2[0] = '['; for(new i = 1; i < 18; i++) { string2[i] = ' '; } string2[18] = ']'; if((Speed[playerid]/10 > 0) && (Speed[playerid]/10 < 17)){ for(new i = 1; i < 18; i++) { if(i < Speed[playerid]/10){ string2[i] = '|'; }else{ string2[i] = ' '; } } } format(string2, sizeof(string2), "{006400}%s",string2); format(string, sizeof(string), "KM/H {006400}%d", GetPlayerSpeed(playerid)); UpdatePlayer3DTextLabelText(playerid, stext[playerid], 0x008080FF, string); UpdatePlayer3DTextLabelText(playerid, stext2[playerid], 0x008080FF, string2); UpdateSpeed_R[playerid] = VehicleSpeed_A; return 1; } else UpdateSpeed_R[playerid] ++; } }
И куда нибудь в конец мода
Code stock GetPlayerSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 150.3; return floatround(ST[3]); }
Скрин :
From Russia With Love!
|
|
|
|