#1

pawn Код:
CMD:vl(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >=5 || IsPlayerAdmin(playerid))
    {
        if(PlayerInfo[playerid][OnDuty] == 0) return SCM(playerid, C_RED, "You're not on duty");
        if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, C_RED, "You need to be in a vehicle");
        new Float:VLX, Float:VLZ, Float:VLY;
        new tmp1[256], tmp2[256], tmp3[256];
        new string[128], Index; tmp1 = strtok(params, Index); tmp2 = strtok(params, Index); tmp3 = strtok(params, Index);
        if(isnull(tmp1) || isnull(tmp2) || isnull(tmp3)) return SCM(playerid, C_RED, "Usage: /vl [X], [Y], [Z]");
        VLX = strval(tmp1);        VLY = strval(tmp2);          VLZ = strval(tmp3);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), VLX, + VLY, + VLZ); //Line 10364 o.o
    }
    else return SendClientMessage(playerid,red, "[ERROR]: You are not a high enough level to use this command");
    return 1;
}
errors given by it:

Код:
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : error 029: invalid expression, assumed zero
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : warning 215: expression has no effect
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : error 029: invalid expression, assumed zero
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : warning 215: expression has no effect
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : error 001: expected token: ";", but found ")"
D:\San Andreas\A Script Folder\gamemodes\asdfaa.pwn(10364) : fatal error 107: too many error messages on one line
I tried thousand times but didnt get this code right if anyone could help?
Reply
#2

You have "+ VLY" and "+ VLZ" but you don't give it anything to plus with.
Reply
#3

you mean another float?
Reply
#4

What are you trying to do with '+' symbol?

pawn Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid), VLX, VLY, VLZ);
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
What are you trying to do with '+' symbol?

pawn Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid), VLX, VLY, VLZ);
Actually I was thinking of something else but that fixed it so i'll stick to it.
Reply
#6

Can I also suggest you something? It's better to use sscanf for splitting the string (for the parameters) because strtok is really bad. Also take a look here:
pawn Код:
new tmp1[256], tmp2[256], tmp3[256];
new string[128]
Do you really need all these? Except the string that is not used, the rest with even size of 16 are fine. Floats cannot be more than lenght 12.
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Can I also suggest you something? It's better to use sscanf for splitting the string (for the parameters) because strtok is really bad. Also take a look here:
pawn Код:
new tmp1[256], tmp2[256], tmp3[256];
new string[128]
Do you really need all these? Except the string that is not used, the rest with even size of 16 are fine. Floats cannot be more than lenght 12.
You got a point actually, and So I fixed it.
Thanks for the help Konstantinos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)