Author Topic: [pawn] Dcmd command errors  (Read 4359 times)

0 Members and 1 Guest are viewing this topic.

Offline bilakispa

  • Street Thug
  • *
  • Posts: 4
    • View Profile
[pawn] Dcmd command errors
« on: March 04, 2010, 12:32:37 am »
Aww, damn it! I can't find what's wrong with this. (Note: I have defined dcmd.)

Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
     dcmd(fix,3,cmdtext); //<--------- LINE 67
     ...other commands..
     return 0;
}

dcmd_fix(playerid, params[])
{
#pragma unused params
if (!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle");
else
{
if (GetPlayerState(playerid) == 2)
{
int vehicleid=GetPlayerVehicleID(playerid); float x,y,z;
RemovePlayerFromVehicle(playerid);
GetVehiclePos(vehicleid, x, y, z);
SetVehicleToRespawn(vehicleid);
SetVehiclePos(vehicleid, x, y, z, 0);
PutPlayerInVehicle(playerid, vehicleid);
}
else SendClientMessage(playerid, COLOR_RED, "You can't fix the vehicle as a passenger");
}
return 1;
}

Compiler Output:
Code: [Select]
C:\Program Files\Rockstar Games\GTA Vice City - Server\gamemodes\mode.pwn(67) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA Vice City - Server\gamemodes\mode.pwn(67) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA Vice City - Server\gamemodes\mode.pwn(67) : warning 215: expression has no effect
C:\Program Files\Rockstar Games\GTA Vice City - Server\gamemodes\mode.pwn(67) : error 001: expected token: ";", but found ")"
C:\Program Files\Rockstar Games\GTA Vice City - Server\gamemodes\mode.pwn(67) : fatal error 107: too many error messages on one line


Also, shouldn't be a GetVehicleRot Function for the vehicle rotation?

Offline bilakispa

  • Street Thug
  • *
  • Posts: 4
    • View Profile
Re: [pawn] Dcmd command errors
« Reply #1 on: March 05, 2010, 12:23:38 am »
Code: [Select]
if (!strcmp(cmd, "!fix", true))
{
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle");
if (GetPlayerState(playerid) != 2) return SendClientMessage(playerid, COLOR_RED, "You can't fix the vehicle as a passeger");
new vehicleid=GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, x, y, z);
GetPlayerFacingAngle(playerid, rot);
SetVehiclePos(vehicleid, x, y, z, rot);
SetVehicleHealth(vehicleid, 1000.0);
    SetVehicleTyre(vehicleid, 1);
SetVehicleLights(vehicleid, 1);
return SendClientMessage(playerid, COLOR_GREEN, "Car fixed!");
}
Nevermind, putted strcmp.

But, does SetVehiclePos() works for you?
I've tried lots of ways but SetVehiclePos() doesn't work.

Offline JayL

  • Street Thug
  • *
  • Posts: 10
    • View Profile
Re: [pawn] Dcmd command errors
« Reply #2 on: March 05, 2010, 05:04:20 am »
It didn't work for me either. Might be buggy just like CreateVehicle.

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: [pawn] Dcmd command errors
« Reply #3 on: March 05, 2010, 07:05:03 pm »
ye i noticed it too