Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CØde credits <Edit it use it in your gamemode you are free just keep the credits ^-^>
- // SA-MP
- #define FILTERSCRIPT
- #include <a_samp>
- #include <a_angles>
- #define GREY 0xAFAFAFAA
- #define BLUE2 0x92E4F4FF
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("CØde Dynamic animations");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print("CØde Dynamic animations");
- print("----------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "hug", 999);
- SetPVarInt(playerid, "shake", 999);
- SetPVarInt(playerid, "kiss", 999);
- SetPVarInt(playerid, "hugtype", 0);
- SetPVarInt(playerid, "useloopanim", 0);
- PreloadAnimLib(playerid,"KISSING");
- PreloadAnimLib(playerid,"PED");
- PreloadAnimLib(playerid,"GANGS");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DeletePVar(playerid, "hug");
- DeletePVar(playerid, "shake");
- DeletePVar(playerid, "kiss");
- DeletePVar(playerid, "hugtype");
- DeletePVar(playerid, "useloopanim");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new string[180];
- new sendername[MAX_PLAYER_NAME];
- new giveplayer[MAX_PLAYER_NAME];
- new cmd[128];
- new tmp[128];
- new idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd,"/gangshake",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, GREY, "/gangshake [playerid] [1 to 8]");
- return 1;
- }
- new playa = ReturnUser(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, GREY, "/gangshake [playerid] [1 to 8]");
- return 1;
- }
- new kind = strval(tmp);
- if(kind < 1 || kind > 8)
- {
- SendClientMessage(playerid, GREY, "availble numbers from 1 to 8");
- return 1;
- }
- if(IsPlayerConnected(playa))
- {
- if(playa != INVALID_PLAYER_ID && playa != playerid)
- {
- if(ProxDetectorS(1.0, playerid, playa))
- {
- GetPlayerName(playa, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "[INFO] You Have Offered %s A hug", giveplayer);
- SendClientMessage(playerid, BLUE2, string);
- format(string, sizeof(string), "[hug] %s is offering you a hug type /accept or /reject", sendername);
- SendClientMessage(playa, BLUE2, string);
- SetPVarInt(playa, "hug", playerid);
- SetPVarInt(playa,"hugtype",kind);
- return 1;
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- else
- {
- SendClientMessage(playerid, GREY, "That player is offline");
- }
- }
- }
- return 1;
- }
- if(strcmp(cmd,"/kiss",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, GREY, "Correct: /kiss [PlayerID]");
- return 1;
- }
- new playa;
- playa = ReturnUser(tmp);
- if(IsPlayerConnected(playa))
- {
- if(playa != INVALID_PLAYER_ID && playa != playerid)
- {
- if(ProxDetectorS(1.0, playerid, playa))
- {
- GetPlayerName(playa, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "[INFO] You Have Offered %s A kiss", giveplayer);
- SendClientMessage(playerid, BLUE2, string);
- format(string, sizeof(string), "[kiss] %s is offering you a kiss type /accept or /reject", sendername);
- SendClientMessage(playa, BLUE2, string);
- SetPVarInt(playa, "kiss", playerid);
- return 1;
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- else
- {
- SendClientMessage(playerid, GREY, "That player is offline");
- }
- }
- }
- return 1;
- }
- if(strcmp(cmd,"/shake",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, GREY, "Correct: /shake [PlayerID]");
- return 1;
- }
- new playa;
- playa = ReturnUser(tmp);
- if(IsPlayerConnected(playa))
- {
- if(playa != INVALID_PLAYER_ID && playa != playerid)
- {
- if(ProxDetectorS(1.0, playerid, playa))
- {
- GetPlayerName(playa, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "[INFO] You Have Offered %s A Hands shake", giveplayer);
- SendClientMessage(playerid, BLUE2, string);
- format(string, sizeof(string), "[HANDSshake] %s is offering you a hands shake type /accept or /reject", sendername);
- SendClientMessage(playa, BLUE2, string);
- SetPVarInt(playa, "shake", playerid);
- return 1;
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- else
- {
- SendClientMessage(playerid, GREY, "That player is offline");
- }
- }
- }
- return 1;
- }
- if(strcmp(cmd,"/accept",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(GetPVarInt(playerid, "hug") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "hug")))
- {
- if (ProxDetectorS(1.0, playerid, GetPVarInt(playerid, "hug")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "hug"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "hug"));
- if(GetPVarInt(playerid,"hugtype") == 1)
- {
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
- ApplyAnimation(playerid,"GANGS","hndshkfa_swt",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 2)
- {
- ApplyAnimation(playerid,"GANGS","hndshkaa",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkaa",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 3)
- {
- ApplyAnimation(playerid,"GANGS","hndshkba",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkba",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 4)
- {
- ApplyAnimation(playerid,"GANGS","hndshkca",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkca",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 5)
- {
- ApplyAnimation(playerid,"GANGS","hndshkcb",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkcb",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 6)
- {
- ApplyAnimation(playerid,"GANGS","hndshkda",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkda",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 7)
- {
- ApplyAnimation(playerid,"GANGS","hndshkea",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkea",4.0,0,0,0,0,0);
- }
- if(GetPVarInt(playerid,"hugtype") == 8)
- {
- ApplyAnimation(playerid,"GANGS","hndshkfa",4.0,0,0,0,0,0);
- ApplyAnimation(GetPVarInt(playerid, "hug"),"GANGS","hndshkfa",4.0,0,0,0,0,0);
- }
- SetPVarInt(playerid, "hug", 999);
- SetPVarInt(playerid, "hugtype", 0);
- return 1;
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- }
- else if(GetPVarInt(playerid, "kiss") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "kiss")))
- {
- if(ProxDetectorS(1.0,playerid, GetPVarInt(playerid, "kiss")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "kiss"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "kiss"));
- ApplyAnimation(GetPVarInt(playerid, "kiss"),"KISSING","Playa_kiss_03",4.0,0,0,0,0,0);
- ApplyAnimation(playerid,"KISSING","Playa_kiss_03",4.0,0,0,0,0,0);
- SetPVarInt(playerid, "kiss", 999);
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- }
- else if(GetPVarInt(playerid, "shake") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "shake")))
- {
- if(ProxDetectorS(1.0,playerid, GetPVarInt(playerid, "shake")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "shake"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "shake"));
- ApplyAnimation(GetPVarInt(playerid, "shake"),"GANGS","prtial_hndshk_biz_01",3.0,0,0,0,0,0);
- ApplyAnimation(playerid,"GANGS","prtial_hndshk_biz_01",3.0,0,0,0,0,0);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- SetPVarInt(playerid, "shake", 999);
- }
- else { return SendClientMessage(playerid, GREY, "You are too far away"); }
- }
- }
- }
- return 1;
- }
- if(strcmp(cmd,"/reject",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(GetPVarInt(playerid, "hug") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "hug")))
- {
- if (ProxDetectorS(1.0, playerid, GetPVarInt(playerid, "hug")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "hug"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "hug"));
- LoopingAnim(playerid,"ped", "endchat_01",4.0,1,0,0,1,1);
- SetTimerEx("removeanim",1500,0,"d",playerid);
- SetPVarInt(playerid, "hug", 999);
- SetPVarInt(playerid, "hugtype", 0);
- return 1;
- }
- }
- }
- else if(GetPVarInt(playerid, "kiss") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "kiss")))
- {
- if(ProxDetectorS(1.0,playerid, GetPVarInt(playerid, "kiss")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "kiss"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "kiss"));
- LoopingAnim(playerid,"ped", "endchat_01",4.0,1,0,0,1,1);
- SetTimerEx("removeanim",1500,0,"d",playerid);
- SetPVarInt(playerid, "kiss", 999);
- return 1;
- }
- }
- }
- else if(GetPVarInt(playerid, "shake") < 999)
- {
- if(IsPlayerConnected(GetPVarInt(playerid, "shake")))
- {
- if(ProxDetectorS(1.0,playerid, GetPVarInt(playerid, "shake")))
- {
- SetPlayerToFacePlayer(GetPVarInt(playerid, "shake"), playerid);
- SetPlayerToFacePlayer(playerid,GetPVarInt(playerid, "shake"));
- LoopingAnim(playerid,"ped", "endchat_01",4.0,1,0,0,1,1);
- SetTimerEx("removeanim",1500,0,"d",playerid);
- SetPVarInt(playerid, "shake", 999);
- return 1;
- }
- }
- }
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- ReturnUser(text[], playerid = INVALID_PLAYER_ID)
- {
- new pos = 0;
- while (text[pos] < 0x21) // Strip out leading spaces
- {
- if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
- pos++;
- }
- new userid = INVALID_PLAYER_ID;
- if (IsNumeric(text[pos])) // Check whole passed string
- {
- // If they have a numeric name you have a problem (although names are checked on id failure)
- userid = strval(text[pos]);
- if (userid >=0 && userid < MAX_PLAYERS)
- {
- if(!IsPlayerConnected(userid))
- {
- userid = INVALID_PLAYER_ID;
- }
- else
- {
- return userid; // A player was found
- }
- }
- }
- new len = strlen(text[pos]);
- new count = 0;
- new name[MAX_PLAYER_NAME];
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- GetPlayerName(i, name, sizeof (name));
- if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
- {
- if (len == strlen(name)) // Exact match
- {
- return i; // Return the exact player on an exact match
- // Otherwise if there are two players:
- // Me and MeYou any time you entered Me it would find both
- // And never be able to return just Me's id
- }
- else // Partial match
- {
- count++;
- userid = i;
- }
- }
- }
- }
- if (count != 1)
- {
- if (playerid != INVALID_PLAYER_ID)
- {
- if (count)
- {
- SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
- }
- }
- userid = INVALID_PLAYER_ID;
- }
- return userid; // INVALID_USER_ID for bad return
- }
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- stock removeanim(playerid)
- {
- StopLoopingAnim(playerid);
- }
- LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
- {
- SetPVarInt(playerid, "useloopanim", 1);
- ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
- }
- forward StopLoopingAnim(playerid);
- public StopLoopingAnim(playerid)
- {
- SetPVarInt(playerid, "useloopanim", 0);
- ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
- }
- forward ProxDetectorS(Float:radi, playerid, targetid);
- public ProxDetectorS(Float:radi, playerid, targetid) //Godfather credits
- {
- //if (gdebug >= 3){//printf("DEBUG ProxDetectorS()");}
- 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
- GetPlayerPos(targetid, 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) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- return 0;
- }
- PreloadAnimLib(playerid, animlib[])
- {
- ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
- }
Advertisement
Add Comment
Please, Sign In to add comment