Sistema para Jogar Futebol
Estava com tempo livre e pensei em fazer um sistema para o player poder jogar futebol.
Imagens:

Código:
pawn Code:
//---------------------------------------------// // Sistema para Jogar Futebol - FS // // Criado By: iHarzard // // Iniciando em Pawn // //---------------------------------------------// #include <a_samp> #include <zcmd> new PlayerJogando[MAX_PLAYERS], keys, updown, leftright, BolaDeFutebol; forward iHazardKeys(); public OnFilterScriptInit() { BolaDeFutebol = CreateObject(1598, 1347.44,2149.91,10.3156, 0, 0, 0); return 1; } public OnFilterScriptExit() { return 1; } CMD:jogar(playerid) return SetTimerEx(#iHazardKeys, 500, 1, #i, playerid), PlayerJogando[playerid] = 1, SendClientMessage(playerid, -1, #Você está jogando futebol agora!); CMD:mc() return DestroyObject(BolaDeFutebol), BolaDeFutebol = CreateObject(1598, 1347.44,2149.91,10.3156, 0, 0, 0); CMD:irestadio(playerid) return SetPlayerPos(playerid, 1347.1750,2112.8821,11.0156), SetPlayerFacingAngle(playerid, 353.1241); public iHazardKeys() { new Float:angle, Float:x, Float:y, Float:z; for(new playerid = 0; playerid < GetMaxPlayers(); playerid++) { GetPlayerKeys(playerid, keys, updown, leftright); GetObjectPos(BolaDeFutebol, x, y, z); GetPlayerFacingAngle(playerid, angle); if(keys == KEY_HANDBRAKE && PlayerJogando[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 1.7, x,y,z)) { GetPlayerPos(playerid, x, y, z); GetXYInFrontOfPlayer(playerid, x, y, 7.0); MoveObject(BolaDeFutebol, x, y, 10.3156, 10.0); ApplyAnimation(playerid, #FIGHT_D, #FightD_1, 4.1, 0, 1, 1, 0, 0); } } else if(keys == KEY_HANDBRAKE + KEY_SPRINT && PlayerJogando[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 1.7, x,y,z)) { GetPlayerPos(playerid, x, y, z); GetXYInFrontOfPlayer(playerid, x, y, 7.0); MoveObject(BolaDeFutebol, x, y, 10.3156, 10.0); ApplyAnimation(playerid, #FIGHT_D, #FightD_1, 4.1, 0, 1, 1, 0, 0); } } } } GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) { new Float:a; GetPlayerPos(playerid, x, y, a); GetPlayerFacingAngle(playerid, a); if (GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); } x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); }
- /jogar - Usado para jogar bola.
- /mc - Usado para retornar a bola ao meio de campo.
- /irestadio - Usado para ir ao estádio de Las Venturas.
Após digitar '/jogar' você poderá mover a bola, apertando o botão direito do seu mouse!
Creditos:
iHazard - Criador do FilterScript.
Y_Less - Criador da Função GetXYInFrontOfPlayer
0 comentários:
Postar um comentário