Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <dini>
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_RED 0xFF0000AA
- #define COLOR_BEIGE 0xFFF8DCAA
- #define COLOR_GREY 0xAFAFAFAA
- #define PlayerSave "mzLove/%s.ini"
- enum pInfo
- {
- Love
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new LoveCar[MAX_PLAYERS];
- new LoveBike[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" mzLove by mobiliz");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new file[100],Name[MAX_PLAYER_NAME],Ip[16];
- GetPlayerName(playerid,Name,sizeof(Name));
- GetPlayerIp(playerid,Ip,sizeof(Ip));
- format(file,sizeof(file),PlayerSave,Name);
- if(!dini_Exists(file)) {
- dini_Create(file);
- dini_IntSet(file,"Love", PlayerInfo[playerid][Love]);
- }
- else if(dini_Exists(file))
- {
- PlayerInfo[playerid][Love] = dini_Int(file,"Love");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[100],Name[MAX_PLAYER_NAME],Ip[16];
- GetPlayerName(playerid,Name,sizeof(Name));
- GetPlayerIp(playerid,Ip,sizeof(Ip));
- format(file,sizeof(file),PlayerSave,Name);
- dini_IntSet(file,"Love", PlayerInfo[playerid][Love]);
- return 1;
- }
- CMD:lcmds(playerid,params[])
- {
- SendClientMessage(playerid, COLOR_YELLOW,"/mylove, /givelove, /lcar (50 love), lbike (45 love), /ldeagle (12 love), /lheal (8 love), /lnos (5 love)");
- SendClientMessage(playerid, COLOR_YELLOW,"/lfix (5 love)");
- return 1;
- }
- CMD:givelove(playerid, params[])
- {
- new str[128], id, amount;
- if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "Usage: /givelove [id] [love]");
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED,"Invaild ID");
- if(id == playerid) return SendClientMessage(playerid, COLOR_RED,"You can't give your self love");
- if(PlayerInfo[playerid][Love] < 1) return SendClientMessage(playerid, COLOR_RED,"Invaild ammount");
- if(PlayerInfo[playerid][Love] < amount) return SendClientMessage(playerid, COLOR_RED, "You need more love to give that much away.");
- PlayerInfo[playerid][Love] -= amount;
- PlayerInfo[id][Love] += amount;
- format(str, sizeof(str), "You gave %i love to %s", amount, GetName(id));
- SendClientMessage(playerid, COLOR_RED, str);
- format(str, sizeof(str), "%s gave you %i love", GetName(playerid), amount);
- SendClientMessage(id, COLOR_YELLOW, str);
- SendClientMessage(id, COLOR_YELLOW, "You can spend love or give your love away!");
- return 1;
- }
- CMD:mylove(playerid, params[])
- {
- new string[128];
- format(string, sizeof(string), "Love: %i", PlayerInfo[playerid][Love]);
- SendClientMessage(playerid ,COLOR_YELLOW, string);
- return 1;
- }
- CMD:lcar(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 50)
- {
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angle);
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You already have a vehicle!");
- LoveCar[playerid] = AddStaticVehicle(451, x, y, z, angle, -1, -1);
- PlayerInfo[playerid][Love] -= 50;
- PutPlayerInVehicle(playerid, LoveCar[playerid], 0);
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a Turismo!");
- }
- else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:lbike(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 45)
- {
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angle);
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You already have a vehicle!");
- LoveBike[playerid] = AddStaticVehicle(522, x, y, z, angle, -1, -1);
- PlayerInfo[playerid][Love] -= 45;
- PutPlayerInVehicle(playerid, LoveBike[playerid], 0);
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a NRG-500!");
- }
- else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:ldeagle(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 12)
- {
- GivePlayerWeapon(playerid, 24, 500);
- PlayerInfo[playerid][Love] -= 12;
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a Deagle!");
- }
- else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:lheal(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 8)
- {
- SetPlayerHealth(playerid, 100.0);
- SetPlayerArmour(playerid, 100.0);
- PlayerInfo[playerid][Love] -= 8;
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Health + Armour!");
- }
- else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:lnos(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 5)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must in vehicle to use this command");
- switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
- {
- case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
- return SendClientMessage(playerid,COLOR_RED,"You can't tune this vehicle!");
- }
- AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
- PlayerInfo[playerid][Love] -= 5;
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Nos!");
- }
- else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:lfix(playerid, params[])
- {
- if(PlayerInfo[playerid][Love] >= 5)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You must in vehicle to use this command");
- new VehicleID = GetPlayerVehicleID(playerid);
- RepairVehicle(VehicleID);
- SetVehicleHealth(VehicleID, 1000);
- PlayerInfo[playerid][Love] -= 5;
- SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Vehicle Fix!");
- }
- else return SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
- return 1;
- }
- CMD:setlove(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not authorized for use this command!");
- new str[128], id, amount2;
- if(sscanf(params, "ui", id, amount2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setlove [id] [amount]");
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invaild ID");
- PlayerInfo[id][Love] = amount2;
- format(str, sizeof(str), "You set %s's love to %i", GetName(id), amount2);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s has set your love to %i", GetName(playerid), amount2);
- SendClientMessage(id, COLOR_YELLOW, str);
- return 1;
- }
- stock GetName(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement