Command problem
#1

Hey why i get this error with this code ?
PHP код:
CMD:sc(playeridparams[])
{
    new 
vehicle;
    new 
ID;// wait
    
new Float:x,Float:y,Float:z;
    if(
ClassPolice == 1)return SendClientMessage(playerid0xffffff"You can't use it"); // 
    
if(sscanf(params"u"ID)) return SendClientMessage(playerid0xffffff"Usage: /sc [playerid]");// 
    
vehicle GetPlayerVehicleID(playerid);
    if(
GetVehicleVelocity(vehicleyz) > 50))
    {
        if(
GetDistanceBetweenPlayers(playerid,ID)  < 12)
        {
            new 
pwlvl GetPlayerWantedLevel(playerid);
            
SetPlayerWantedLevel(playerid,pwlvl+1);
        }
    }
    return 
1;
}
forward Float:GetDistanceBetweenPlayers(p1,p2);
public 
Float:GetDistanceBetweenPlayers(p1,p2)
{
    new 
Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if (!
IsPlayerConnected(p1) || !IsPlayerConnected(p2))
    {
        return -
1.00;
    }
    
GetPlayerPos(p1,x1,y1,z1);
    
GetPlayerPos(p2,x2,y2,z2);
    return 
floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

warning 205: redundant code: constant expression is zero
C:\Users\janno\Desktop\UUS\gamemodes\Trucking.pwn( 172 : error 029: invalid expression, assumed zero
Reply
#2

pawn Код:
if(GetVehicleVelocity(vehicle, x , y, z) > 50))
You get error because there's unmatched closing parenthesis at the end. Also that if statement won't work properly. GetVehicleVelocity function returns multiple values, the x, y and z velocities are stored in the referenced variables.
Reply
#3

i have already defined vehicle which will not give you errors or multiple values & yes if(GetVehicleVelocity(vehicle, x , y, z) > 50)) will not work properly ..
Reply
#4

What he meant it that you have one extra ")" at the end of the "if" statement.

fix:
pawn Код:
if(GetVehicleVelocity(vehicle, x , y, z) > 50)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)