laptop
#1

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?
Reply
#2

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?
Reply
#3

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
Reply
#4

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

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?
Reply
#6

i need this for that command:





understand?
Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply
#10

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)