26.06.2015, 19:30
how can i create a /nrg command ? but i i want to be inside the nrg when it spawns , just nrg thanks
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;
}
#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;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
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,nrg, 0);
SendClientMessage(playerid,0xFF000000, "You have sucessfully spawed a NRG-500. Enjoy!");
return 1;
}
return 0;
}