Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: bilakispa on March 03, 2010, 10:32:37 PM

Title: [pawn] Dcmd command errors
Post by: bilakispa on March 03, 2010, 10:32:37 PM
Aww, damn it! I can't find what's wrong with this. (Note: I have defined dcmd.)

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:
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?
Title: Re: [pawn] Dcmd command errors
Post by: bilakispa on March 04, 2010, 10:23:38 PM
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.
Title: Re: [pawn] Dcmd command errors
Post by: JayL on March 05, 2010, 03:04:20 AM
It didn't work for me either. Might be buggy just like CreateVehicle.
Title: Re: [pawn] Dcmd command errors
Post by: thijn on March 05, 2010, 05:05:03 PM
ye i noticed it too