How to stop the error ?
#1

Thankyou to all who helped
Reply
#2

You open a function, but dont close it.
pawn Code:
if(strcmp("/aflip", cmdtext, true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerScore(playerid, 100))
            {
                new vehicle;
                new Float:zangle;
                vehicle = GetPlayerVehicleID(playerid);
                GetVehicleZAngle(vehicle,zangle);
                SetVehicleZAngle(vehicle,zangle);
                SendClientMessage(playerid, COLOR_NAVY, "[APS]Vehicle Flipped");
                return 1;
            } else return SendClientMessage(playerid, COLOR_NAVY, "You dont have 100 score!");
        } else return SendClientMessage(playerid, COLOR_NAVY, "Youre not in a vehicle");
        return 1;
    }
Also, may i suggest you should use ZCMD, since its faster then strcmp & its easier to use?
Reply
#3

my whole game mode is in strcmp it was a edit but it was a basic start the rockzville truck edit but has totally changed now , i wouldnt no how to convert to zcmd
Reply
#4

pawn Code:
if(!strcmp----blalbla)
That is for strcmp
pawn Code:
CMD:commandname(playerid, params[])
COMMAND:commandname(playerid, params[])
command(commandname, playerid, params[]) // not sure about this one
Those are for zcmd. Just change them
Reply
#5

thanks the compound statement works
Reply
#6

Try it:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/anos", cmdtext, true) == 0) {
        new vehicle = GetPlayerVehicleID(playerid);
        if(GetPlayerScore(playerid) == 100) {
            AddVehicleComponent(vehicle, 10);
            SendClientMessage(playerid, COLOR_NAVY, "[APS]Nos Added");
        }
        return 1;
    }
    if(strcmp("/aflip", cmdtext, true) == 0) {
        if(IsPlayerInAnyVehicle(playerid)) {
            if(GetPlayerScore(playerid) == 100) {
                new vehicle;
                new Float:zangle;
                vehicle = GetPlayerVehicleID(playerid);
                GetVehicleZAngle(vehicle,zangle);
                SetVehicleZAngle(vehicle,zangle);
                SendClientMessage(playerid, COLOR_NAVY, "[APS]Vehicle Flipped");
            }
        }
        return 1;
    }
    if(strcmp("/arepair", cmdtext, true) == 0) {
        if(!IsPlayerInAnyVehicle(playerid)) {
            if(GetPlayerScore(playerid) == 100) {
                RepairVehicle(GetPlayerVehicleID(playerid));
                SendClientMessage(playerid, 0x000080FF, "[APS]Your vehicle has been successfully repaired!");
            }
        }
        return 1;
    }
    return false
}
Reply
#7

I fixed it now thankyou btw monsieur yours has 1 error
Reply
#8

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/anos", cmdtext, true) == 0)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(GetPlayerScore(playerid) >= 100)
        {
            AddVehicleComponent(vehicle, 1010);
            SendClientMessage(playerid, COLOR_NAVY, "[APS]Nos Added");
            return 1;
        }
    }
    if(strcmp("/aflip", cmdtext, true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerScore(playerid) >= 100)
            {
                new vehicle;
                new Float:zangle;
                vehicle = GetPlayerVehicleID(playerid);
                GetVehicleZAngle(vehicle,zangle);
                SetVehicleZAngle(vehicle,zangle);
                SendClientMessage(playerid, COLOR_NAVY, "[APS]Vehicle Flipped");
            }
        }
        return 1;
    }
    if(strcmp("/arepair", cmdtext, true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerScore(playerid) >= 100)
            {
                RepairVehicle(GetPlayerVehicleID(playerid));
                SendClientMessage(playerid, 0x000080FF, "[APS]Your vehicle has been successfully repaired!");
            }
        }
        return 1;
    }
    return 0;
}
^ Try with that.

There are a lot of problems in your code:
1) Your "if" statements are wrong. I suggest that you read this: https://sampwiki.blast.hk/wiki/Control_Structures#if
2) You are using a wrong component id in /anos -> https://sampwiki.blast.hk/wiki/Car_Components
3)
Quote:
Originally Posted by Wesley221
View Post
You open a function, but dont close it.
Reply
#9

no errors and no warnings thanks


can mods delete this topic
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)