needing help
#1

How can i make a /v cmd to spawn vehicles?
Reply
#2

Something like this: - I havent tested this, but it should work.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(!strcmp("/v", cmdtext))
     {
          strdel(cmdtext, 0, 3);
          if(strlen(cmdtext) == 0) return SendClientMessage(playerid, COLOUR, "Usage: /v [vid]");
          new Float:x, Float:y, Float:z;
          GetPlayerPos(playerid, x, y, z);
          CreateVehicle(strval(cmdtext), x+3, y+3, z, 0.0, -1, -1, -1);
          return 1;
     }
     return 0;
}
Reply
#3

i get this

EDIT: thanks it works man!

but when i do /v 493 it says unknown cmd
Reply
#4

Quote:
Originally Posted by _Sprite_
Посмотреть сообщение
i get this

EDIT: thanks it works man!

but when i do /v 493 it says unknown cmd
Use sscanf or dcmd... Strcmp is pretty hard.
Reply
#5

ZCMD
pawn Код:
COMMAND:v(playerid, params[])
{
    new tmp;
    if(sscanf(params,"i",tmp)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /adcar [CarID]");
    else
    {
        new Float:x,Float:y,Float:z,Float:Angle;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid,Angle);
        CreateVehicle(tmp,x+2*floatsin(-Angle, degrees),y+2*floatcos(-Angle, degrees),z+1,Angle+90,0,0,99999999999);
        return 1;
    }
}
strtok
pawn Код:
if(strcmp(cmd, "/v", true) == 0)
{
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v [carid]");
    new modelid= strval(tmp);
    new Float:x,Float:y,Float:z,Float:Angle;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,Angle);
    CreateVehicle(modelid,x+3*floatsin(-Angle, degrees),y+3*floatcos(-Angle, degrees),z+1,Angle+90,0,0,99999999999);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)