Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define COLOR_RED 0xFF0000FF
- #define COLOR_YELLOW 0x00FFFFFF
- #define COLOR_GREEN 0x00FF00FF
- #define cookies 3 // amount of cookies
- new pickupids, pickup, bool:takenbyplayer;
- public OnFilterScriptInit()
- {
- print("************* Hidden Pickup Creator v3 Loaded *************");
- print("----------------------[smileyforcheat]---------------------");
- print("***********************************************************");
- return 1;
- }
- COMMAND:createhiddenpickup(playerid, params[])
- {
- new szString[128], Float:X, Float:Y, Float:Z;
- if(sscanf(params, "d", pickupids)) return SendClientMessage(playerid, COLOR_RED, "* You have to insert the pickup id."),
- GameTextForPlayer(playerid, "~r~~h~You have to~n~insert the pickup id", 3000, 3);
- takenbyplayer = false;
- GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
- GetXYInFrontOfPlayer(playerid, Float:X, Float:Y, 2.0);
- pickup = CreatePickup(pickupids, 2, Float:X, Float:Y, Float:Z, GetPlayerVirtualWorld(playerid));
- format(szString, sizeof(szString), "* You have been placed the hidden pickup for %d Cookies", cookies);
- SendClientMessage(playerid, COLOR_YELLOW, szString);
- return 1;
- }
- COMMAND:rocket(playerid, params[])
- {
- if(0 >= GetPVarInt(playerid, "Cookies"))
- {SendClientMessage(playerid, COLOR_RED, "* You dont have any cookies to change it into a rockets!");}
- else
- {
- GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 10), SetPVarInt(playerid, "Cookies", GetPVarInt(playerid, "Cookies")-1);
- new szString[128];
- format(szString, sizeof(szString), "* You have been used your cookies to get rockets. You have %d cookies left.", GetPVarInt(playerid, "Cookies"));
- SendClientMessage(playerid, COLOR_GREEN, szString);}
- return 1;
- }
- COMMAND:deletehiddenpickup(playerid, params[])
- {
- DestroyPickup(pickup);
- SendClientMessage(playerid, COLOR_YELLOW, "* The hidden pickup has been deleted");
- takenbyplayer = false;
- return 1;
- }
- COMMAND:mycookies(playerid, params[])
- {
- new szString[128];
- format(szString, sizeof(szString), "* You have %d cookies, you can type rocket if you own ones", GetPVarInt(playerid, "Cookies"));
- SendClientMessage(playerid, COLOR_GREEN, szString);
- return 1;
- }
- COMMAND:chp(playerid, params[])
- {
- return cmd_createhiddenpickup(playerid, params);
- }
- COMMAND:dhp(playerid, params[])
- {
- return cmd_deletehiddenpickup(playerid, params);
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == pickup)
- {
- if(takenbyplayer == true) { SendClientMessage(playerid, COLOR_YELLOW, "* Sorry the hidden pickup already taken by other players"); return 1;}
- new szString[128];
- takenbyplayer = true;
- format(szString, sizeof(szString), "* You have been found the hidden pickup for %d cookies", cookies);
- SendClientMessage(playerid, COLOR_GREEN, szString);
- SendClientMessage(playerid, COLOR_GREEN, "* You can use your cookies by typing /rocket");
- SetPVarInt(playerid, "Cookies", GetPVarInt(playerid, "Cookies")+3);
- new szString2[128], szName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, szName, sizeof(szName));
- format(szString2, sizeof(szString2), "~y~~h~%s (ID:%d)~n~~g~~h~has been found~n~~b~~h~the hidden pickup~n~~g~~h~and won 3 cookies", szName, playerid);
- GameTextForAll(szString2, 5000, 3);
- }
- return 1;
- }
- stock 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));
- }
Advertisement
Add Comment
Please, Sign In to add comment