SA-MP Forums Archive
laptop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: laptop (/showthread.php?tid=595390)



laptop - GeneralAref - 02.12.2015

i have this command
Код:
CMD:ar(playerid, params[])
{
    if(GetPVarInt(playerid,"AirReconOnline"))return SendClientMessage(playerid,COLOR_RED,"ERROR: You have already set the Air Recon Online!");
    if(gTeam[playerid] != TEAM_Internationalforces) return SendClientMessage(playerid,COLOR_RED,"ERROR: Your team dosent have Satellite!");
    if(gTeam[playerid] == TEAM_Internationalforces)
    {
        if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid,0xFF0000FF,"You dont have money to use Satellite!");
        SendClientMessage(playerid,COLOR_BLUE,"i need air recon online!");
        SendClientMessage(playerid,COLOR_BLUE,"copy that we are coming to your position in 2 sec!");
        SendClientMessage(playerid,COLOR_RED,"You lost $90000 for air recon.");
        TogglePlayerControllable(playerid, 0);
        new Float:v, Float:c, Float:r;
        GetPlayerPos(playerid, v, c, r);
        SetPlayerCameraPos(playerid, v, c, r+30);
        SetPlayerCameraLookAt(playerid, v, c, r);
        SetTimer("endar", 60000, false);
        GivePlayerMoney(playerid, -90000);
        SetPVarInt(playerid,"AirReconOnline",true); 
        return SendClientMessage(playerid,COLOR_BLUE,"We are in your position you can use Satellite!");
      }
   	return 1;
}
i need if player type it first see this:

and after that see this:

and go to sky
and after end timer see picture 1.
Do you know me?


Re: laptop - Jay_Dixon - 02.12.2015

I'll try and understand you here. You want it to spawn a laptop. Then open it?

I mean if you wanna spawn it. Why not use CreateDynamicObject, and have it spawn a couple feet away from the player?


Re: laptop - SnG.Scot_MisCuDI - 02.12.2015

If you havnt already download Streamer
At the top of your script place
Код:
#include <streamer>
Now, using the map editor hit "Show Code" at the top.
Select CreateDynamicObject
Copy and paste that code in your script
Код:
CMD:ar(playerid, params[])
{
    if(GetPVarInt(playerid,"AirReconOnline"))return SendClientMessage(playerid,COLOR_RED,"ERROR: You have already set the Air Recon Online!");
    if(gTeam[playerid] != TEAM_Internationalforces) return SendClientMessage(playerid,COLOR_RED,"ERROR: Your team dosent have Satellite!");
    if(gTeam[playerid] == TEAM_Internationalforces)
    {
        new laptop;
        if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid,0xFF0000FF,"You dont have money to use Satellite!");
        SendClientMessage(playerid,COLOR_BLUE,"i need air recon online!");
        SendClientMessage(playerid,COLOR_BLUE,"copy that we are coming to your position in 2 sec!");
        SendClientMessage(playerid,COLOR_RED,"You lost $90000 for air recon.");
        TogglePlayerControllable(playerid, 0);
        new Float:v, Float:c, Float:r;
        GetPlayerPos(playerid, v, c, r);
        //laptop = createdynamicobject 
        SetPlayerCameraPos(playerid, v, c, r+30);
        SetPlayerCameraLookAt(playerid, v, c, r);
        SetTimer("endar", 60000, false);
        GivePlayerMoney(playerid, -90000);
        SetPVarInt(playerid,"AirReconOnline",true); 
        return SendClientMessage(playerid,COLOR_BLUE,"We are in your position you can use Satellite!");
      }
   	return 1;
}
You might want to use a timer so the player can see the laptop before his camera position gets changed here
Код:
 SetPlayerCameraPos(playerid, v, c, r+30);
SetPlayerCameraLookAt(playerid, v, c, r);
And in the timer 'endar' delete the object you created using DestroyDynamicObject(laptop);


***This is all from the top of my head so may not even make sense


Re: laptop - GeneralAref - 03.12.2015

im not understand.can you complete it?i have streamer.i cant make objact for player.


Re: laptop - N0FeaR - 03.12.2015

Quote:
Originally Posted by GeneralAref
Посмотреть сообщение
im not understand.can you complete it?i have streamer.i cant make objact for player.
Whats the problem here?


Re: laptop - GeneralAref - 03.12.2015

i need this for that command:





understand?


Re: laptop - Virtual1ty - 03.12.2015

Something like this?
PHP код:
forward startairrecon(playeridlaptop_objidFloat:xFloat:yFloat:zFloat:a);
forward endar(playeridlaptop_objid);
CMD:ar(playeridparams[])
{
    if(
GetPVarInt(playerid,"AirReconOnline")) return SendClientMessage(playerid,COLOR_RED,"ERROR: You have already set the Air Recon Online!");
    if(
gTeam[playerid] != TEAM_Internationalforces) return SendClientMessage(playerid,COLOR_RED,"ERROR: Your team dosent have Satellite!");
    if(
gTeam[playerid] == TEAM_Internationalforces)
    {
        if(
GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid,0xFF0000FF,"You dont have money to use Satellite!");
        
SendClientMessage(playerid,COLOR_BLUE,"i need air recon online!");
        
SendClientMessage(playerid,COLOR_BLUE,"copy that we are coming to your position in 2 sec!");
        
SendClientMessage(playerid,COLOR_RED,"You lost $90000 for air recon.");
        
GivePlayerMoney(playerid, -90000);
        new 
Float:xFloat:yFloat:zFloat:alaptop_objid;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playerida);
        
laptop_objid CreateObject(19894,
                                    
+ (0.5 floatsin(-adegrees)),
                                    
+ (0.5 floatcos(-adegrees)),
                                    
0.150.00.0a);
        
SetTimerEx("startairrecon"2000false"iiffff"playeridlaptop_objidxyza);
    }
    return 
1;
}
public 
startairrecon(playeridlaptop_objidFloat:xFloat:yFloat:zFloat:a)
{
    
SetPVarInt(playerid,"AirReconOnline",true); 
    
SendClientMessage(playerid,COLOR_BLUE,"We are in your position you can use Satellite!");
    if (
IsValidObject(laptop_objid)) DestroyObject(laptop_objid);
    new 
objid;
    
objid CreateObject(19893,
                         
+ (0.5 floatsin(-adegrees)),
                         
+ (0.5 floatcos(-adegrees)),
                         
0.150.00.0a);
    
SetPlayerCameraPos(playeridxyz+30.0);
    
SetPlayerCameraLookAt(playeridxyz);
    
SetTimerEx("endar"60000false"ii"playeridobjid);
    return 
1;
}
public 
endar(playeridlaptop_objid)
{
    if (
IsValidObject(laptop_objid)) DestroyObject(laptop_objid);
    new 
Float:xFloat:yFloat:zFloat:aobj;
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
// trigonometry "magic", adjust numbers at will
    
+= 0.5 floatsin(-adegrees);
    
+= 0.5 floatcos(-adegrees);
    
+= 0.15;
    
// optionally you may want to save the object id
    // so you can remove the object afterwards
    
CreateObject(19894xyz0.00.0a);
    
// presumably you want this too + SetCameraBehindPlayer()
    
TogglePlayerControllable(playerid1); 
    return 
1;

Does what you asked, adjust to your needs.


Re: laptop - GeneralAref - 03.12.2015

laptop 1 not destroyed.and laptop 2 Must be destroyed.

can you add animation for this?and how to make objact for player?gas mask and shield.Tell me all about it.


Re: laptop - Virtual1ty - 03.12.2015

Editing the code is easy, if you want laptops to be destroyed you must call DestroyObject somewhere.

There are no "animations" for objects, you can only change their position and rotation.
However, some objects are "animated" and usually play it in a loop.

You can use objects created by the SA-MP Team which include a few masks and a shield, yes.
You can attach the objects anywhere on a player by manually scripting it or by using the ever popular Hold Studio by Slice.

No one is going to write code for you, we are only here to help you solve a problem,
it is up to you to write the code and then post here if you're having problems with it.


Re: laptop - GeneralAref - 04.12.2015

Код:
CMD:ar(playerid, params[])
{
    if(GetPVarInt(playerid,"AirReconOnline")) return SendClientMessage(playerid,COLOR_RED,"ERROR: You have already set the Air Recon Online!");
    if(gTeam[playerid] != TEAM_Internationalforces) return SendClientMessage(playerid,COLOR_RED,"ERROR: Your team dosent have Satellite!");
    if(gTeam[playerid] == TEAM_Internationalforces)
    {
        if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid,0xFF0000FF,"You dont have money to use Satellite!");
        SendClientMessage(playerid,COLOR_BLUE,"i need air recon online!");
        SendClientMessage(playerid,COLOR_BLUE,"copy that we are coming to your position in 2 sec!");
        SendClientMessage(playerid,COLOR_RED,"You lost $90000 for air recon.");
        GivePlayerMoney(playerid, -90000);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
        TogglePlayerControllable(playerid, 0);
        new Float:x, Float:y, Float:z, Float:a, laptop_objid;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        laptop_objid = CreateObject(19894,
                                    x + (0.5 * floatsin(-a, degrees)),
                                    y + (0.5 * floatcos(-a, degrees)),
                                    z + 0.15, 0.0, 0.0, a);
        SetTimerEx("startairrecon", 2000, false, "iiffff", playerid, laptop_objid, x, y, z, a);
    }
    return 1;
}
public startairrecon(playerid, laptop_objid, Float:x, Float:y, Float:z, Float:a)
{
    SetPVarInt(playerid,"AirReconOnline",true);
    SendClientMessage(playerid,COLOR_BLUE,"We are in your position you can use Satellite!");
    GivePlayerWeapon(playerid, 0, 1);
    DestroyObject(laptop_objid);

    new objid;
    objid = CreateObject(19893,
                         x + (0.4 * floatsin(-a, degrees)),
                         y + (0.4 * floatcos(-a, degrees)),
                         z + 0.16, 0.0, 0.0, a);
                         
    SetPlayerCameraPos(playerid, x, y, z+30.0);
    SetPlayerCameraLookAt(playerid, x, y, z);

    SetTimerEx("endar", 60000, false, "ii", playerid, objid);
    return 1;
}

public endar(playerid, laptop_objid)
{
    DestroyObject(laptop_objid);
    
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    // trigonometry "magic", adjust numbers at will
    x += 0.5 * floatsin(-a, degrees);
    y += 0.5 * floatcos(-a, degrees);
    z += 0.15;
    // optionally you may want to save the object id
    // so you can remove the object afterwards
    CreateObject(19894, x, y, z, 0.0, 0.0, a);
    // presumably you want this too + SetCameraBehindPlayer()
    SetCameraBehindPlayer(playerid);
    DeletePVar(playerid,"AirReconOnline");
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
    TogglePlayerControllable(playerid, 1);
    return 1;
}