Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SA-MP Filterscript
- *
- * (c) Copyright 2012, Kaliber V 1.0
- *
- */
- #include <a_samp>
- /******************************************************************************/
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_LIGHTGREEN 0x7CFC00AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- /******************************************************************************/
- #define Dialog0 3239
- /******************************************************************************/
- forward Korb(playerid);
- forward Korb1(playerid);
- forward Verloren(playerid);
- /******************************************************************************/
- enum pInfo{
- pBall,
- pBesitzt,
- pTimer,
- pWurf,
- pRichtung,
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- /******************************************************************************/
- public OnFilterScriptInit()
- {
- print("\n\tCopyright (c) by Kaliber\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- DestroyObject(PlayerInfo[i][pBall]);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/ball", true) == 0)
- {
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED,"Du darfst dafür in keinem Auto sitzen !");
- if(PlayerInfo[playerid][pBesitzt] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED,"Du besitzt schon einen Ball !");
- if(Platz(playerid))
- {
- new Float: X, Float: Y, Float: Z, Float: A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- PlayerInfo[playerid][pBall] = CreateObject(2114,X,Y,Z,0,0,A,200.0);
- AttachObjectToPlayer(PlayerInfo[playerid][pBall], playerid, 0.05, 0.25, 0.0, 0.0, 0.5, 0.5);
- PlayerInfo[playerid][pBesitzt] = 1;
- SendClientMessage(playerid, COLOR_LIGHTBLUE,"Du hast dir erfolgreich einen Basketball geholt !");
- return 1;
- }
- else
- {
- return SendClientMessage(playerid, COLOR_LIGHTRED,"Du bist nicht am Basketball Platz Tippe: {FFFFFF}/platz");
- }
- }
- if(strcmp(cmdtext, "/platz", true) == 0)
- {
- ShowPlayerDialog(playerid,Dialog0,DIALOG_STYLE_LIST,"{FF0000}Wähle einen Basketball Platz !","Los Santos Groove Street","Bestätigen","Abbrechen");
- return 1;
- }
- if(strcmp(cmdtext, "/ablegen", true) == 0)
- {
- DestroyObject(PlayerInfo[playerid][pBall]);
- PlayerInfo[playerid][pBesitzt] = 0;
- PlayerInfo[playerid][pWurf] = 0;
- KillTimer(PlayerInfo[playerid][pTimer]);
- SendClientMessage(playerid, COLOR_YELLOW,"Du hast den Ball erfolgreich weggeschmissen !");
- return 1;
- }
- return 0;
- }
- public OnPlayerDisconnect(playerid)
- {
- DestroyObject(PlayerInfo[playerid][pBall]);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == Dialog0)
- {
- if(response == 1)
- {
- switch (listitem)
- {
- case 0:
- {
- SetPlayerPos(playerid, 2524.3328,-1667.5042,15.0407);
- SetPlayerFacingAngle(playerid, 268.9362);
- SetCameraBehindPlayer(playerid);
- SendClientMessage(playerid, COLOR_LIGHTBLUE,"Willkommen auf dem Basketball Platz in Los Santos !");
- }
- }
- }
- if(response == 0)
- {
- return 1;
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (PRESSED(KEY_SECONDARY_ATTACK))
- {
- if(PlayerInfo[playerid][pBesitzt] == 1)
- {
- if(PlayerInfo[playerid][pWurf] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED,"Du wirfst gerade schon !");
- new Float: X, Float: Y, Float: Z, Float: A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- SendClientMessage(playerid, COLOR_LIGHTBLUE,"Ball erfolgreich geworfen !");
- DestroyObject(PlayerInfo[playerid][pBall]);
- if(A >= 210 && A < 300)
- {
- PlayerInfo[playerid][pRichtung] = 1;
- PlayerInfo[playerid][pBall] = CreateObject(2114, X+1, Y, Z, 0, 0, A, 200.0);
- MoveObject(PlayerInfo[playerid][pBall], X+10, Y, Z+5, 4.0, 0, 0, A);
- }
- else if(A >= 0 && A < 120)
- {
- PlayerInfo[playerid][pRichtung] = 2;
- PlayerInfo[playerid][pBall] = CreateObject(2114, X-1, Y, Z, 0, 0, A, 200.0);
- MoveObject(PlayerInfo[playerid][pBall], X-10, Y, Z+5, 4.0, 0, 0, A);
- }
- else if(A >= 300)
- {
- PlayerInfo[playerid][pRichtung] = 3;
- PlayerInfo[playerid][pBall] = CreateObject(2114, X, Y+1, Z, 0, 0, A, 200.0);
- MoveObject(PlayerInfo[playerid][pBall], X, Y+10, Z+5, 4.0, 0, 0, A);
- }
- else if(A >= 120 && A <= 209)
- {
- PlayerInfo[playerid][pRichtung] = 4;
- PlayerInfo[playerid][pBall] = CreateObject(2114, X, Y-1, Z, 0, 0, A, 200.0);
- MoveObject(PlayerInfo[playerid][pBall], X, Y-10, Z+5, 4.0, 0, 0, A);
- }
- PlayerInfo[playerid][pWurf] = 1;
- SetTimerEx("Korb1", 1000*2, 0, "i", playerid);
- }
- }
- return 1;
- }
- public Korb1(playerid)
- {
- PlayerInfo[playerid][pTimer] = SetTimerEx("Korb", 1, 1, "i",playerid);
- return 1;
- }
- public Korb(playerid)
- {
- if(PlayerInfo[playerid][pBesitzt] == 0) return 1;
- new Float: X, Float: Y, Float: Z, Float: X1, Float: Z1, Float: Y1;
- GetPlayerPos(playerid, X1, Y1, Z1);
- if(GetObjectPos(PlayerInfo[playerid][pBall], X, Y, Z))
- {
- if(ObjectToPoint(1.0, PlayerInfo[playerid][pBall], 2533.4287,-1667.4817,16.9912))
- {
- Gewonnen(playerid);
- PlayerInfo[playerid][pWurf] = 0;
- KillTimer(PlayerInfo[playerid][pTimer]);
- return 1;
- }
- if(Z <= Z1)
- {
- PlayerInfo[playerid][pWurf] = 0;
- KillTimer(PlayerInfo[playerid][pTimer]);
- SendClientMessage(playerid, COLOR_LIGHTRED,"Du hast den Korb nicht getroffen, versuche es erneut !");
- SetTimerEx("Verloren", 1000*5, 0, "i", playerid);
- return 1;
- }
- if(PlayerInfo[playerid][pRichtung] == 1)
- {
- MoveObject(PlayerInfo[playerid][pBall], X+5, Y, Z-2, 4.0, 0, 0, 0);
- }
- else if(PlayerInfo[playerid][pRichtung] == 2)
- {
- MoveObject(PlayerInfo[playerid][pBall], X-5, Y, Z-2, 4.0, 0, 0, 0);
- }
- else if(PlayerInfo[playerid][pRichtung] == 3)
- {
- MoveObject(PlayerInfo[playerid][pBall], X, Y+5, Z-2, 4.0, 0, 0, 0);
- }
- else if(PlayerInfo[playerid][pRichtung] == 4)
- {
- MoveObject(PlayerInfo[playerid][pBall], X, Y-5, Z-2, 4.0, 0, 0, 0);
- }
- }
- return 1;
- }
- public Verloren(playerid)
- {
- AttachObjectToPlayer(PlayerInfo[playerid][pBall], playerid, 0.05, 0.25, 0.0, 0.0, 0.5, 0.5);
- return 1;
- }
- /******************************************************************************/
- stock Gewonnen(playerid)
- {
- new name[MAX_PLAYER_NAME], string[256];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string),"Spieler {FF0000}%s{FFFF00} hat den Basketball Korb getroffen !",name);
- SendClientMessageToAll(COLOR_YELLOW, string);
- AttachObjectToPlayer(PlayerInfo[playerid][pBall], playerid, 0.05, 0.25, 0.0, 0.0, 0.5, 0.5);
- return 1;
- }
- stock Platz(playerid)
- {
- if(PlayerToPoint(15.0, playerid, 2524.3328,-1667.5042,15.0407)) return 1;
- return 0;
- }
- stock split(const strsrc[], strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc)){
- if(strsrc[i]==delimiter || i==strlen(strsrc)){
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return 1;
- }
- stock ObjectToPoint(Float:radi, objectid, Float:x, Float:y, Float:z)
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetObjectPos(objectid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- return 0;
- }
- stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- /******************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment