Why is this cmd not working?
#1

Please briefly explain what I did wrong, don't just give me the code I need to put, tyty in advance

PHP код:
CMD:veh(playeridparams[])
{
    new 
vehidfloat:xfloat:yfloat:z;
    if(
sscanf(params"i"vehid)) return SendClientMessage(playerid, -1"[USAGE]: /veh [vehid]");
    
GetPlayerPos(playeridxyz);
    
CreateVehicle(vehidx+3.0yz0.0000);
    return 
1;

Reply
#2

Код:
CMD:veh(playerid, params[])
{
    new vehid;
    if (sscanf(params, "i", vehid)) {
        SendClientMessage(playerid, -1, "[USAGE]: /veh [vehid 400 - 611]");
        return 1;
    }
    if (vehid < 400 || vehid > 611) {
        SendClientMessage(playerid, -1, "[USAGE]: /veh [vehid 400 - 611]");
        return 1;
    }
    new Float:x, Float:y, Float:z, Float:a, Float:tA;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    tA = a < 270.0 ? a + 90.0 : a - 270.0;
    CreateVehicle(vehid, x + (floatsin(-a, degrees) * 5.0), y + (floatcos(-a, degrees) * 5.0), z, tA, 0, 0, 0);
    return 1;
}
Reply
#3

What is this? lol

tA = a < 270.0 ? a + 90.0 : a - 270.0;

I don't really care about all the extra stuff like the angle and all, I just want the cmd to spawn the vehid that's put in the cmd. Just want it to spawn x+3. Don't care about the angle at all.

The simpler the better please, I'm new to scripting just trying to make simple commands to learn the basics.
Reply
#4

Quote:
Originally Posted by aKnoxx
Посмотреть сообщение
What is this? lol

tA = a < 270.0 ? a + 90.0 : a - 270.0;
When the vehicle spawns in front of you, it'll be facing to the left - meaning the driver door will be facing you.
Reply
#5

Quote:
Originally Posted by BeckzyBoi
Посмотреть сообщение
When the vehicle spawns in front of you, it'll be facing to the left - meaning the driver door will be facing you.
I don't need all that. I just want to know why the cmd I made isn't working xD ty for all that though

It's not spawning any cars at all when I try and use it in-game. So I type /veh 400 and nothing happens
Reply
#6

Try this:
Код:
CMD:veh(playerid, params[])
{
    new vehid;
    if (sscanf(params, "i", vehid)) {
        SendClientMessage(playerid, -1, "[USAGE]: /veh [vehid 400 - 611]");
        return 1;
    }
    if (vehid < 400 || vehid > 611) {
        SendClientMessage(playerid, -1, "[USAGE]: /veh [vehid 400 - 611]");
        return 1;
    }
    new Float:x, Float:y, Float:z, Float:a, Float:tA, vid;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    tA = a < 270.0 ? a + 90.0 : a - 270.0;
    vid = CreateVehicle(vehid, x + (floatsin(-a, degrees) * 5.0), y + (floatcos(-a, degrees) * 5.0), z, tA, 0, 0, 0);
    SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(vid, GetPlayerInterior(playerid));
    return 1;
}
Reply
#7



Can you just tell me why this isnt working?

PHP код:
CMD:veh(playeridparams[]) 

    new 
vehidfloat:xfloat:yfloat:z
    if(
sscanf(params"i"vehid)) return SendClientMessage(playerid, -1"[USAGE]: /veh [vehid]"); 
    
GetPlayerPos(playeridxyz); 
    
CreateVehicle(vehidx+3.0yz0.0000); 
    return 
1

Reply
#8

That should spawn the vehicle in front of you, facing left, and in the same virtual world & interior as you.

Edit:
Код:
new vehid, float:x, float:y, float:z;
should be:
Код:
new vehid, Float:x, Float:y, Float:z;
Reply
#9

THANK YOU!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)