ZCMD problem? :-\
#3

Im not %100 sure i know what u mean but i think i do. Im not very good at writting tutorials but this should work try and see whats going on its easier than strtok. I commented best i could.

pawn Код:
COMMAND:vehicle(playerid,params[])
{
    new sub[24];//this will hold what the player typed in after /vehicle
    if(sscanf(params,"s[24]",sub))return SendClientMessage(playerid,0xff0000FF,"Error usage /vehicle [commandid]");//if player didn't type anything after /vehicle send error message
    //after sscanf sub will hold what player typed in after /vehicle
   
    if(!strcmp(sub,"lock",true,4))//sub holds params (what player typed in) compare it to 'lock'
    {
        for(new i; i <= MAX_PLAYERS;i++)
        {
            if(i == playerid || i == INVALID_PLAYER_ID)continue;
            //SetVehicleParamsForPlayer(Motori[i][mModel],i,1,1);
        }
        SendClientMessage(playerid,0xff0000FF,"Your vehicle is locked");
        return 1;
    }

    if(!strcmp(sub,"unlock",true,6))//compare sub to 'unlock'
    {
        for(new i; i <= MAX_PLAYERS;i++)
        {
            if(i == playerid || i == INVALID_PLAYER_ID)continue;
            //SetVehicleParamsForPlayer(Motori[i][mModel],i,1,0);
        }
        SendClientMessage(playerid,0xff0000FF,"Your vehicle is unlocked");
        return 1;
    }

    if(!strcmp(sub,"parkiraj",true,8))
    {
        //blahblah
    }
    return 1;
}
COMMAND:v(playerid,params[])
{
    return cmd_vehicle(playerid,params);//if player typed /v return the vehicle command.
}
EDIT: setvehicle params function commented so i could test it for errors (no errors).
Reply


Messages In This Thread
ZCMD problem? :-\ - by DarkPower - 16.08.2010, 23:22
Re: ZCMD problem? :-\ - by DarkPower - 17.08.2010, 11:19
Re: ZCMD problem? :-\ - by iggy1 - 17.08.2010, 13:45

Forum Jump:


Users browsing this thread: 3 Guest(s)