SA-MP Forums Archive
/nrg command - 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: /nrg command (/showthread.php?tid=579380)



/nrg command - OmarSerry - 26.06.2015

how can i create a /nrg command ? but i i want to be inside the nrg when it spawns , just nrg thanks


Re: /nrg command - UltraScripter - 26.06.2015

pawn Код:
CMD:nrg(playerid, params[])
{
    new Car, Float:x, Float:y, Float:z, Float:k;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, k);
    Car = CreateVehicle(522, x, y, z, k, -1, -1, -1);
    PutPlayerInVehicle(playerid, (Car), 0);
        return 1;
}



Re: /nrg command - OmarSerry - 26.06.2015

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
pawn Код:
CMD:nrg(playerid, params[])
{
    new Car, Float:x, Float:y, Float:z, Float:k;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, k);
    Car = CreateVehicle(522, x, y, z, k, -1, -1, -1);
    PutPlayerInVehicle(playerid, (Car), 0);
        return 1;
}
Thx +Rep


Re: /nrg command - Abagail - 26.06.2015

pawn Код:
#include <a_samp>
#include <zcmd>
new playerNRG[MAX_PLAYERS] = INVALID_VEHICLE_ID;
public OnPlayerDisconnect(playerid, reason)
{
    if(playerNRG[playerid] != INVALID_VEHICLE_ID)
    {
        DestroyVehicle(playerNRG[playerid]);
        playerNRG[playerid] = INVALID_VEHICLE_ID;
    }
   
    return 1;
}
   
   
CMD:nrg(playerid, params[])
{
    if(GetPlayerVehicleID(playerid)) {
        RemovePlayerFromVehicle(playerid);
    }
   
    if(playerNRG[playerid])
    {
        DestroyVehicle(playerNRG[playerid]);
        playerNRG[playerid] = INVALID_VEHICLE_ID;
    }
   
    new Float: x, Float: y, Float: z;
    GetPlayerPos(playerid, x, y, z);
   
    playerNRG[playerid] = CreateVehicle(522, x, y, z, 0.0, 0, 1, -1);
    if(playerNRG[playerid] != INVALID_VEHICLE_ID) // vehicle was created
    {
        PutPlayerInVehicle(playerid, playerNRG[playerid], 0);
    }
   
    return 1;
}



Re: /nrg command - Michael B - 26.06.2015

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
     if(!
strcmp(cmdtext,"/nrg",true))
     {
     
GetPlayerPos(playerid,Pose[1],Pose[2],Pose[3]);
     
nrg=CreateVehicle(522,Pose[1],Pose[2],Pose[3],0,-1,-1,10);
     
PutPlayerInVehicle(playerid,nrg0);
     
SendClientMessage(playerid,0xFF000000"You have sucessfully spawed a NRG-500. Enjoy!");
     return 
1;
     }
return 
0;

Edit: Too late...Been on Android.