Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "a_samp"
- #include <zcmd>
- new Squirtle[MAX_PLAYERS];
- new SquirtleTime[MAX_PLAYERS];
- forward Squirtle_I_Choose_Youuuuu(playerid);
- public Squirtle_I_Choose_Youuuuu(playerid)
- {
- new Float:phrr[4];
- new playerstate = GetPlayerState(playerid);
- if (playerstate == PLAYER_STATE_DRIVER
- || playerstate == PLAYER_STATE_PASSENGER)
- {
- GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
- GetPlayerFacingAngle(playerid, phrr[3]);
- SetObjectRot(Squirtle[playerid],0.0, 0.0, phrr[3]);
- MoveObject(Squirtle[playerid], phrr[0]+0.5,phrr[1],phrr[2],10000);
- }
- if (playerstate == PLAYER_STATE_ONFOOT)
- {
- GetPlayerPos(playerid, phrr[0],phrr[1],phrr[2]);
- GetPlayerFacingAngle(playerid, phrr[3]);
- SetObjectRot(Squirtle[playerid],0.0, 0.0, phrr[3]);
- MoveObject(Squirtle[playerid], phrr[0]+0.5,phrr[1],phrr[2],10);
- }
- return 1;
- }
- COMMAND:goturtle(playerid,params[])
- {
- new Float:x1,Float:y1,Float:z1,Float:a;
- if( GetPlayerScore(playerid) >= 1000)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid,4))
- {
- GetPlayerPos(playerid,x1,y1,z1);
- GetPlayerFacingAngle(playerid, a);
- Squirtle[playerid] = CreateObject(1609,x1,y1,z1-1,a,0.0,0.0);
- SquirtleTime[playerid] = SetTimerEx("Squirtle_I_Choose_Youuuuu",1000,true, "i", playerid);
- SendClientMessage(playerid, 0x00FF00FF,"TURTLE I CHOOSE YOUU , GO!");
- SendClientMessage(playerid, 0xFFFF00FF,"Now use /getturtle to get it back");
- }
- }
- return 1;
- }
- COMMAND:getturtle(playerid,params[])
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid,4))
- {
- SendClientMessage(playerid, 0x00FF00FF,"COME BACK, TURTLE!");
- KillTimer(SquirtleTime[playerid]);
- DestroyObject(Squirtle[playerid]);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- KillTimer(SquirtleTime[playerid]);
- return 1;
- }
- COMMAND:buyturtle(playerid,params[])
- {
- if (IsPlayerAttachedObjectSlotUsed(playerid, 4) == 0)
- {
- SetPlayerAttachedObject(playerid, 4, 1609, 10, 0.0, 0.0,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0x00FF00FF,"You have bought turtle");
- SendClientMessage(playerid, 0x00FF00FF,"Now use /goturtle to call it!");
- GivePlayerMoney(playerid, -20000);
- }
- return 1;
- }
- COMMAND:sellturtle(playerid,params[])
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid,4))
- {
- RemovePlayerAttachedObject(playerid,4);
- DestroyObject(Squirtle[playerid]);
- SendClientMessage(playerid, 0x00FF00FF,"You have sold turtle");
- GivePlayerMoney(playerid, 19000);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement