Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #define DIALOG_WEAPONS 50000
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define COLOR_RED 0xFF0000AA
- #define COLOR_PURPLE 0x9E18E7FF
- new PlayerWeapon1[MAX_PLAYERS] = 0, PlayerWeapon2[MAX_PLAYERS] = 0, PlayerWeapon3[MAX_PLAYERS] = 0;
- new TaktikObject[MAX_PLAYERS], TaktikToggle[MAX_PLAYERS] = 0;
- new Float:FPos[MAX_PLAYERS][3];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("V-Weapons 1.0 Loaded...");
- print("V-Weapons 1.0 by -Viper-");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetTimerEx("V_Weapons", 500, 1, "d", playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- DestroyObject(TaktikObject[playerid]);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(TaktikToggle[playerid] == 1)
- {
- DestroyObject(TaktikObject[playerid]);
- SetPlayerPos(playerid, FPos[playerid][0], FPos[playerid][1], FPos[playerid][2]);
- TaktikToggle[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(vhelp, 5, cmdtext);
- dcmd(vweapon, 7, cmdtext);
- dcmd(vweaponlist, 11, cmdtext);
- return 0;
- }
- dcmd_vhelp(playerid, params[])
- {
- #pragma unused params
- SendClientMessage(playerid, COLOR_PURPLE, "V-Weapons {FFFFFF}1.0{9E18E7} made by {FFFFFF}-Viper-");
- SendClientMessage(playerid, COLOR_PURPLE, "V-Weapons Commands:");
- SendClientMessage(playerid, COLOR_PURPLE, "{FFFFFF}/vhelp{9E18E7} - to see the Help");
- SendClientMessage(playerid, COLOR_PURPLE, "{FFFFFF}/vweapon{9E18E7} - give a Player a Weapon");
- SendClientMessage(playerid, COLOR_PURPLE, "{FFFFFF}/vweaponlist{9E18E7} - to see the new Weapon ID´s");
- return 1;
- }
- dcmd_vweapon(playerid, params[])
- {
- new pid, weaponid, weaponammo;
- new string[128], YourName[20], GiveName[20];
- if(sscanf(params,"ddd",pid,weaponid,weaponammo))
- {
- return SendClientMessage(playerid, COLOR_RED, "Usage: /vweapon [playerid] [weaponid] [weaponammo]");
- }
- if(!IsPlayerConnected(pid))
- {
- return SendClientMessage(playerid, COLOR_RED, "[ERROR]No one is online with this id!");
- }
- GetPlayerName(pid, GiveName, sizeof(GiveName));
- GetPlayerName(playerid, YourName, sizeof(YourName));
- V_GivePlayerWeapon(pid, weaponid, weaponammo);
- format(string, sizeof(string), "V_GivePlayerWeapon: %s give %s a Weapon (%d) with %d Ammo", YourName, GiveName, weaponid, weaponammo);
- SendClientMessageToAll(COLOR_PURPLE, string);
- return 1;
- }
- dcmd_vweaponlist(playerid, params[])
- {
- #pragma unused params
- SendClientMessage(playerid, 0xFFFFFFFF, "PSG - 47 | Nails Baseball Bat - 48 | Skull Bat - 49\nGuitar 1 - 50 | Guitar 2 - 51 | Guitar 3 - 52 | MP5 Elite - 53 | Tactical Insertion - 54");
- return 1;
- }
- forward V_Weapons(playerid);
- public V_Weapons(playerid)
- {
- switch(GetPlayerWeapon(playerid))
- {
- case 0:
- {
- if(PlayerWeapon3[playerid] == 0)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon3[playerid] == 1)
- {
- if(TaktikToggle[playerid] == 0)
- {
- SetPlayerAttachedObject(playerid, 0, 354, 5, 0.09, 0.00, -0.01, 0.0, 93.0, 0.0, 0.39, 0.43, 0.44);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(TaktikToggle[playerid] == 1)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- }
- }
- case 1..4:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 5:
- {
- if(PlayerWeapon2[playerid] == 0)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon2[playerid] == 1)
- {
- SetPlayerAttachedObject(playerid, 0, 2045, 6, 0.049999, 0.019999, 0.240000, 94.000000, 0.000000, 0.000000, 1.400000, 1.300000, 1.300000);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon2[playerid] == 2)
- {
- SetPlayerAttachedObject(playerid, 0, 3524, 6, 0.069999, 0.009999, 0.300000, 4.000000, 0.000000, 90.000000, 0.300000, 0.300000, 0.200000);
- RemovePlayerAttachedObject(playerid, 1);
- }
- }
- case 6..14:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 15:
- {
- if(PlayerWeapon2[playerid] == 0)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon2[playerid] == 3)
- {
- SetPlayerAttachedObject(playerid, 0, 19317, 6, 0.07, 0.00, 0.41, 2.0, 181.0, 0.0, 1.00, 1.10, 1.00);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon2[playerid] == 4)
- {
- SetPlayerAttachedObject(playerid, 0, 19318, 6, 0.05, 0.00, 0.49, 3.0, 177.0, 1.0, 1.02, 1.21, 1.12);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon2[playerid] == 5)
- {
- SetPlayerAttachedObject(playerid, 0, 19319, 6, 0.09, 0.00, 0.42, 3.0, 179.0, -1.0, 1.04, 1.40, 1.00);
- RemovePlayerAttachedObject(playerid, 1);
- }
- }
- case 16..24:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 25:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 26..28:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 29:
- {
- if(PlayerWeapon1[playerid] == 0)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon1[playerid] == 2)
- {
- SetPlayerAttachedObject(playerid, 1, 2036, 6, 0.180000, 0.009999, 0.170000, 90.000000, -7.000000, 7.000000, 0.299999, 0.500000, 0.380000);
- if (IsPlayerAiming(playerid))
- {
- if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
- {
- SetPlayerAttachedObject(playerid, 0, 18643, 6, 0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
- }
- else
- {
- SetPlayerAttachedObject(playerid, 0, 18643, 6, 0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
- }
- }
- else
- {
- if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
- {
- SetPlayerAttachedObject(playerid, 0, 18643, 6, 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
- }
- else
- {
- SetPlayerAttachedObject(playerid, 0, 18643, 6, 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
- }
- }
- }
- }
- case 30..33:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- case 34:
- {
- if(PlayerWeapon1[playerid] == 0)
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- else if(PlayerWeapon1[playerid] == 1)
- {
- SetPlayerAttachedObject(playerid, 0, 2036, 6, 0.449999, 0.000000, 0.099999, 90.000000, -4.000000, 7.000000, 1.279999, 1.029999, 1.090000);
- RemovePlayerAttachedObject(playerid, 1);
- }
- }
- case 35..46:
- {
- RemovePlayerAttachedObject(playerid, 0);
- RemovePlayerAttachedObject(playerid, 1);
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(KEY_FIRE))
- {
- if(PlayerWeapon3[playerid] == 1)
- {
- if(GetPlayerWeapon(playerid) == 0)
- {
- if(TaktikToggle[playerid] == 0)
- {
- GetPlayerPos(playerid, FPos[playerid][0], FPos[playerid][1], FPos[playerid][2]);
- TaktikToggle[playerid] = 1;
- TaktikObject[playerid] = CreateObject(354, FPos[playerid][0], FPos[playerid][1], FPos[playerid][2]-1, 0, 0, 0);
- }
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- new Float:health;
- if(issuerid != INVALID_PLAYER_ID)
- {
- switch(GetPlayerWeapon(issuerid))
- {
- case 0..4: {}
- case 5:
- {
- if(PlayerWeapon2[issuerid] == 1)//Nate
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-8);
- }
- else if(PlayerWeapon2[issuerid] == 2)//Skull
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-7);
- }
- }
- case 6..14: {}
- case 15:
- {
- if(PlayerWeapon2[issuerid] == 3)//Guitar 1
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-5);
- }
- else if(PlayerWeapon2[issuerid] == 4)//Guitar 2
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-5);
- }
- else if(PlayerWeapon2[issuerid] == 5)//Guitar 3
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-5);
- }
- }
- case 16..28: {}
- case 29:
- {
- if(PlayerWeapon1[issuerid] == 2)//MP5 Elite
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-12);
- }
- }
- case 30..33: {}
- case 34:
- {
- if(PlayerWeapon1[issuerid] == 1)//PSG
- {
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-53);
- }
- }
- case 35..46: {}
- }
- }
- return 1;
- }
- stock V_GivePlayerWeapon(playerid, weaponid, ammo)
- {
- switch(weaponid)
- {
- case 1:{ GivePlayerWeapon(playerid, 1, ammo);PlayerWeapon2[playerid] = 0;}
- case 2:{ GivePlayerWeapon(playerid, 2, ammo);PlayerWeapon2[playerid] = 0;}
- case 3:{ GivePlayerWeapon(playerid, 3, ammo);PlayerWeapon2[playerid] = 0;}
- case 4:{ GivePlayerWeapon(playerid, 4, ammo);PlayerWeapon2[playerid] = 0;}
- case 5:{ GivePlayerWeapon(playerid, 5, ammo);PlayerWeapon2[playerid] = 0;}
- case 6:{ GivePlayerWeapon(playerid, 6, ammo);PlayerWeapon2[playerid] = 0;}
- case 7:{ GivePlayerWeapon(playerid, 7, ammo);PlayerWeapon2[playerid] = 0;}
- case 8:{ GivePlayerWeapon(playerid, 8, ammo);PlayerWeapon2[playerid] = 0;}
- case 9:{ GivePlayerWeapon(playerid, 9, ammo);PlayerWeapon2[playerid] = 0;}
- case 10:{ GivePlayerWeapon(playerid, 10, ammo);PlayerWeapon2[playerid] = 0;}
- case 11:{ GivePlayerWeapon(playerid, 11, ammo);PlayerWeapon2[playerid] = 0;}
- case 12:{ GivePlayerWeapon(playerid, 12, ammo);PlayerWeapon2[playerid] = 0;}
- case 13:{ GivePlayerWeapon(playerid, 13, ammo);PlayerWeapon2[playerid] = 0;}
- case 14:{ GivePlayerWeapon(playerid, 14, ammo);PlayerWeapon2[playerid] = 0;}
- case 15:{ GivePlayerWeapon(playerid, 15, ammo);PlayerWeapon2[playerid] = 0;}
- case 16:{ GivePlayerWeapon(playerid, 16, ammo);}
- case 17:{ GivePlayerWeapon(playerid, 17, ammo);}
- case 18:{ GivePlayerWeapon(playerid, 18, ammo);}
- case 22:{ GivePlayerWeapon(playerid, 22, ammo);}
- case 23:{ GivePlayerWeapon(playerid, 23, ammo);}
- case 24:{ GivePlayerWeapon(playerid, 24, ammo);}
- case 25:{ GivePlayerWeapon(playerid, 25, ammo);PlayerWeapon1[playerid] = 0;}
- case 26:{ GivePlayerWeapon(playerid, 26, ammo);PlayerWeapon1[playerid] = 0;}
- case 27:{ GivePlayerWeapon(playerid, 27, ammo);PlayerWeapon1[playerid] = 0;}
- case 28:{ GivePlayerWeapon(playerid, 28, ammo);PlayerWeapon1[playerid] = 0;}
- case 29:{ GivePlayerWeapon(playerid, 29, ammo);PlayerWeapon1[playerid] = 0;}
- case 30:{ GivePlayerWeapon(playerid, 30, ammo);PlayerWeapon1[playerid] = 0;}
- case 31:{ GivePlayerWeapon(playerid, 31, ammo);PlayerWeapon1[playerid] = 0;}
- case 32:{ GivePlayerWeapon(playerid, 32, ammo);PlayerWeapon1[playerid] = 0;}
- case 33:{ GivePlayerWeapon(playerid, 33, ammo);PlayerWeapon1[playerid] = 0;}
- case 34:{ GivePlayerWeapon(playerid, 34, ammo);PlayerWeapon1[playerid] = 0;}
- case 35:{ GivePlayerWeapon(playerid, 35, ammo);PlayerWeapon1[playerid] = 0;}
- case 36:{ GivePlayerWeapon(playerid, 36, ammo);PlayerWeapon1[playerid] = 0;}
- case 37:{ GivePlayerWeapon(playerid, 37, ammo);}
- case 38:{ GivePlayerWeapon(playerid, 38, ammo);}
- case 39:{ GivePlayerWeapon(playerid, 39, ammo);}
- case 40:{ GivePlayerWeapon(playerid, 40, ammo);}
- case 41:{ GivePlayerWeapon(playerid, 41, ammo);}
- case 42:{ GivePlayerWeapon(playerid, 42, ammo);}
- case 43:{ GivePlayerWeapon(playerid, 43, ammo);}
- case 44:{ GivePlayerWeapon(playerid, 44, ammo);}
- case 45:{ GivePlayerWeapon(playerid, 45, ammo);}
- case 46:{ GivePlayerWeapon(playerid, 46, ammo);}
- case 47: { GivePlayerWeapon(playerid, 34, ammo); PlayerWeapon1[playerid] = 1; }//PSG
- case 48: { GivePlayerWeapon(playerid, 5, ammo); PlayerWeapon2[playerid] = 1; }//Nail
- case 49: { GivePlayerWeapon(playerid, 5, ammo); PlayerWeapon2[playerid] = 2; }//Skull
- case 50: { GivePlayerWeapon(playerid, 15, ammo); PlayerWeapon2[playerid] = 3; }//Guitar 1
- case 51: { GivePlayerWeapon(playerid, 15, ammo); PlayerWeapon2[playerid] = 4; }//Guitar 2
- case 52: { GivePlayerWeapon(playerid, 15, ammo); PlayerWeapon2[playerid] = 5; }//Guitar 3
- case 53: { GivePlayerWeapon(playerid, 29, ammo); PlayerWeapon1[playerid] = 2; }//MP5 Elite
- case 54: { PlayerWeapon3[playerid] = 1; }//Tactical
- }
- return 1;
- }
- stock IsPlayerAiming(playerid)
- {
- new anim = GetPlayerAnimationIndex(playerid);
- if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
- (anim == 1643) || (anim == 1453) || (anim == 220))return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement